diff --git a/bin/java-petstore-all.sh b/bin/java-petstore-all.sh index 714faa4dc71e..e12ddf3c51ad 100755 --- a/bin/java-petstore-all.sh +++ b/bin/java-petstore-all.sh @@ -6,8 +6,8 @@ ./bin/java-petstore-google-api-client.sh ./bin/java-petstore-jersey1.sh ./bin/java-petstore-jersey2-java6.sh +./bin/java-petstore-jersey2-java7.sh ./bin/java-petstore-jersey2-java8.sh -./bin/java-petstore-jersey2.sh ./bin/java-petstore-microprofile.sh ./bin/java-petstore-native.sh ./bin/java-petstore-okhttp-gson-parcelable.sh diff --git a/bin/java-petstore-jersey2-java6.sh b/bin/java-petstore-jersey2-java6.sh index 4a5b032d0db7..bd673d765171 100755 --- a/bin/java-petstore-jersey2-java6.sh +++ b/bin/java-petstore-jersey2-java6.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-jersey2-java6 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 --additional-properties hideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is $@" +ags="generate --artifact-id petstore-jersey2-java6 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -o samples/client/petstore/java/jersey2-java6 --additional-properties hideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/jersey2-java6/src/main" rm -rf samples/client/petstore/java/jersey2-java6/src/main diff --git a/bin/java-petstore-jersey2-java7.json b/bin/java-petstore-jersey2-java7.json new file mode 100644 index 000000000000..a5e2254fdb3a --- /dev/null +++ b/bin/java-petstore-jersey2-java7.json @@ -0,0 +1,5 @@ +{ + "library": "jersey2", + "java8": false, + "artifactId": "petstore-jersey2-java7" +} diff --git a/bin/java-petstore-jersey2.sh b/bin/java-petstore-jersey2-java7.sh similarity index 94% rename from bin/java-petstore-jersey2.sh rename to bin/java-petstore-jersey2-java7.sh index b6cd91ea9aec..a72b3365d4b4 100755 --- a/bin/java-petstore-jersey2.sh +++ b/bin/java-petstore-jersey2-java7.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 --additional-properties hideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2-java7.json -o samples/client/petstore/java/jersey2-java7 --additional-properties java8=false,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main" rm -rf samples/client/petstore/java/jersey2/src/main diff --git a/bin/java-petstore-jersey2.json b/bin/java-petstore-jersey2.json deleted file mode 100644 index 79ed4cbc2e12..000000000000 --- a/bin/java-petstore-jersey2.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "library": "jersey2", - "artifactId": "petstore-jersey2" -} diff --git a/bin/windows/java-petstore-all.bat b/bin/windows/java-petstore-all.bat index 816919bb8fd1..e141ec8ef9f1 100644 --- a/bin/windows/java-petstore-all.bat +++ b/bin/windows/java-petstore-all.bat @@ -1,5 +1,5 @@ call .\bin\windows\java-petstore-jersey1.bat -call .\bin\windows\java-petstore-jersey2.bat +call .\bin\windows\java-petstore-jersey2-java8.bat call .\bin\windows\java-petstore-feign.bat call .\bin\windows\java-petstore-feign-10x.bat call .\bin\windows\java-petstore-native.bat diff --git a/bin/windows/java-petstore-jersey2-java6.bat b/bin/windows/java-petstore-jersey2-java6.bat index e41cf3964691..4efac3d2d7ce 100644 --- a/bin/windows/java-petstore-jersey2-java6.bat +++ b/bin/windows/java-petstore-jersey2-java6.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate --artifact-id petstore-jersey2-java6 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-jersey2.json -o samples\client\petstore\java\jersey2-java6 --additional-properties hideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is +set ags=generate --artifact-id petstore-jersey2-java6 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -o samples\client\petstore\java\jersey2-java6 --additional-properties hideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-jersey2.bat b/bin/windows/java-petstore-jersey2-java8.bat similarity index 71% rename from bin/windows/java-petstore-jersey2.bat rename to bin/windows/java-petstore-jersey2-java8.bat index f0f5ea9e2d5b..7ea0c334e78a 100644 --- a/bin/windows/java-petstore-jersey2.bat +++ b/bin/windows/java-petstore-jersey2-java8.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-jersey2.json -o samples\client\petstore\java\jersey2 --additional-properties hideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-jersey2-java7.json -o samples\client\petstore\java\jersey2 --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index 399aa7f5fcbb..d5efbbd4ba4b 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -24,7 +24,7 @@ sidebar_label: groovy |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index 47c60b6f501a..240a6bb85e25 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -26,7 +26,7 @@ sidebar_label: java-inflector |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.controllers| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index 7b37f5dd9a6e..2a7c74842272 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -27,7 +27,7 @@ sidebar_label: java-msf4j |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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)|
**jersey1**
Jersey core 1.x
**jersey2**
Jersey core 2.x
|jersey2| |licenseName|The name of the license| |Unlicense| diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index a78d000aa76d..360cecdad37b 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -28,7 +28,7 @@ sidebar_label: java-pkmst |groupId|groupId in generated pom.xml| |com.prokarma| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |com.prokarma.pkmst.controller| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 47dc598c83c2..db5a6cce52d7 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -30,7 +30,7 @@ sidebar_label: java-play-framework |handleExceptions|Add a 'throw exception' to each controller function. Add also a custom error handler where you can put your custom logic| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 641ed21d2c5e..2975825ef19c 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -26,7 +26,7 @@ sidebar_label: java-undertow-server |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.handler| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index 1fe08d3b107c..96c7193b2881 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -26,7 +26,7 @@ sidebar_label: java-vertx-web |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.vertxweb.server| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index e2d68f9c5e31..626eca2911f9 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -26,7 +26,7 @@ sidebar_label: java-vertx |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java.md b/docs/generators/java.md index 3ca1326e164b..716c1beb9b57 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -29,7 +29,7 @@ sidebar_label: java |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.client| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit**
HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x
|okhttp-gson| |licenseName|The name of the license| |Unlicense| @@ -51,7 +51,7 @@ sidebar_label: java |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|source folder for generated code| |src/main/java| -|supportJava6|Whether to support Java6 with the Jersey1 library.| |false| +|supportJava6|Whether to support Java6 with the Jersey1 library. This option has been deprecated and will be removed in the 5.x release| |false| |useBeanValidation|Use BeanValidation API annotations| |false| |useGzipFeature|Send gzip-encoded requests| |false| |usePlayWS|Use Play! Async HTTP client (Play WS API)| |false| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index dbb740fd3741..d42714ad38ed 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -30,7 +30,7 @@ sidebar_label: jaxrs-cxf-cdi |implFolder|folder for generated implementation code| |src/main/java| |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
|<default>| |licenseName|The name of the license| |Unlicense| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index 41b28b8bc0b8..cea106975e6e 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -26,7 +26,7 @@ sidebar_label: jaxrs-cxf-client |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index 68373c8e73bc..b514e1d4b0f6 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -33,7 +33,7 @@ sidebar_label: jaxrs-cxf-extended |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index 4e524009c7c1..b65f8d844bc9 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -32,7 +32,7 @@ sidebar_label: jaxrs-cxf |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 80948607ec94..9618f052ab6b 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -27,7 +27,7 @@ sidebar_label: jaxrs-jersey |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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)|
**jersey1**
Jersey core 1.x
**jersey2**
Jersey core 2.x
|jersey2| |licenseName|The name of the license| |Unlicense| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 50c05785dc61..8961c6da03dd 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -28,7 +28,7 @@ sidebar_label: jaxrs-resteasy-eap |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index 66e7882c4409..bcff6b2d13a0 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -28,7 +28,7 @@ sidebar_label: jaxrs-resteasy |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 1d4e97cbf8b6..3deb5c4260a2 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -30,7 +30,7 @@ sidebar_label: jaxrs-spec |implFolder|folder for generated implementation code| |src/main/java| |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
|<default>| |licenseName|The name of the license| |Unlicense| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 93159837dd49..6116bd3f430f 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -34,7 +34,7 @@ sidebar_label: spring |implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false| |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used
**false**
Various third party libraries as needed
|false| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**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)|
**spring-boot**
Spring-boot Server application using the SpringFox integration.
**spring-mvc**
Spring-MVC Server application using the SpringFox integration.
**spring-cloud**
Spring-Cloud-Feign client with Spring-Boot auto-configured settings.
|spring-boot| |licenseName|The name of the license| |Unlicense| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index b1c48917d726..b0778f11f038 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -62,7 +62,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code protected String dateLibrary = "threetenbp"; protected boolean supportAsync = false; - protected boolean java8Mode = false; + protected boolean java8Mode = true; protected boolean withXml = false; protected String invokerPackage = "org.openapitools"; protected String groupId = "org.openapitools"; @@ -205,7 +205,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code dateLibrary.setEnum(dateOptions); cliOptions.add(dateLibrary); - CliOption java8Mode = CliOption.newBoolean(JAVA8_MODE, "Option. Use Java8 classes instead of third party equivalents", this.java8Mode); + CliOption java8Mode = CliOption.newBoolean(JAVA8_MODE, "Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped", this.java8Mode); Map java8ModeOptions = new HashMap<>(); java8ModeOptions.put("true", "Use Java 8 classes such as Base64"); java8ModeOptions.put("false", "Various third party libraries as needed"); @@ -480,10 +480,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code importMapping.put("com.fasterxml.jackson.annotation.JsonProperty", "com.fasterxml.jackson.annotation.JsonCreator"); if (additionalProperties.containsKey(JAVA8_MODE)) { + LOGGER.info("containing java 8 mode ..."); setJava8Mode(Boolean.parseBoolean(additionalProperties.get(JAVA8_MODE).toString())); if (java8Mode) { - additionalProperties.put("java8", "true"); + LOGGER.info("containing java 8 mode to true..."); + additionalProperties.put("java8", true); + } else { + additionalProperties.put("java8", false); } + LOGGER.info("containing java 8 mode to something {}...", java8Mode); } if (additionalProperties.containsKey(SUPPORT_ASYNC)) { 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 ff4168bfa4c2..d524849dd9ab 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 @@ -135,7 +135,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(PARCELABLE_MODEL, "Whether to generate models for Android that implement Parcelable with the okhttp-gson library.")); cliOptions.add(CliOption.newBoolean(USE_PLAY_WS, "Use Play! Async HTTP client (Play WS API)")); cliOptions.add(CliOption.newString(PLAY_VERSION, "Version of Play! Framework (possible values \"play24\", \"play25\" (default), \"play26\")")); - cliOptions.add(CliOption.newBoolean(SUPPORT_JAVA6, "Whether to support Java6 with the Jersey1 library.")); + cliOptions.add(CliOption.newBoolean(SUPPORT_JAVA6, "Whether to support Java6 with the Jersey1 library. This option has been deprecated and will be removed in the 5.x release")); 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")); diff --git a/pom.xml b/pom.xml index 05c553e33b89..426790d06a4b 100644 --- a/pom.xml +++ b/pom.xml @@ -691,7 +691,7 @@ - java-client-jersey2 + java-client-jersey2-java7 env @@ -699,7 +699,7 @@ - samples/client/petstore/java/jersey2 + samples/client/petstore/java/jersey2-java7 @@ -1303,7 +1303,6 @@ samples/client/petstore/java/feign samples/client/petstore/java/feign10x samples/client/petstore/java/jersey1 - samples/client/petstore/java/jersey2 samples/client/petstore/java/jersey2-java8 samples/client/petstore/java/okhttp-gson samples/client/petstore/java/retrofit @@ -1397,7 +1396,7 @@ samples/client/petstore/scala-httpclient samples/client/petstore/java/feign samples/client/petstore/java/jersey1 - samples/client/petstore/java/jersey2 + samples/client/petstore/java/jersey2-java7 samples/client/petstore/java/okhttp-gson samples/client/petstore/java/retrofit samples/client/petstore/java/retrofit2 diff --git a/samples/client/petstore/java/jersey2-java6/README.md b/samples/client/petstore/java/jersey2-java6/README.md index 6b7be6d30a2b..5d0d673579b1 100644 --- a/samples/client/petstore/java/jersey2-java6/README.md +++ b/samples/client/petstore/java/jersey2-java6/README.md @@ -1,7 +1,6 @@ # petstore-jersey2-java6 OpenAPI Petstore - - API version: 1.0.0 This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ @@ -9,10 +8,10 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + ## Requirements Building the API client library requires: - 1. Java 1.6+ 2. Maven/Gradle @@ -63,8 +62,8 @@ mvn clean package Then manually install the following JARs: -- `target/petstore-jersey2-java6-1.0.0.jar` -- `target/lib/*.jar` +* `target/petstore-jersey2-java6-1.0.0.jar` +* `target/lib/*.jar` ## Getting Started @@ -72,30 +71,31 @@ Please follow the [installation](#installation) instruction and execute the foll ```java -import org.openapitools.client.*; -import org.openapitools.client.auth.*; -import org.openapitools.client.model.*; +// Import classes: +import 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 AnotherFakeApiExample { +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); - Client body = new Client(); // Client | client model - try { - Client result = apiInstance.call123testSpecialTags(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(); - } + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(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(); } + } } ``` @@ -200,26 +200,22 @@ Class | Method | HTTP request | Description Authentication schemes defined for the API: ### 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 ### petstore_auth - - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/java/jersey2-java6/build.gradle b/samples/client/petstore/java/jersey2-java6/build.gradle index 3c60f38a12b6..eb7e3e4b54c3 100644 --- a/samples/client/petstore/java/jersey2-java6/build.gradle +++ b/samples/client/petstore/java/jersey2-java6/build.gradle @@ -1,5 +1,6 @@ apply plugin: 'idea' apply plugin: 'eclipse' +apply plugin: 'java' group = 'org.openapitools' version = '1.0.0' @@ -18,7 +19,9 @@ buildscript { repositories { jcenter() } - +sourceSets { + main.java.srcDirs = ['src/main/java'] +} if(hasProperty('target') && target == 'android') { @@ -49,7 +52,7 @@ if(hasProperty('target') && target == 'android') { } dependencies { - provided 'javax.annotation:jsr250-api:1.0' + provided 'javax.annotation:javax.annotation-api:1.3.2' } } @@ -78,6 +81,7 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' + sourceCompatibility = JavaVersion.VERSION_1_6 targetCompatibility = JavaVersion.VERSION_1_6 @@ -93,33 +97,17 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.5.22" - jackson_version = "2.10.3" - jackson_databind_version = "2.10.3" - jackson_databind_nullable_version = "0.2.1" - jersey_version = "2.6" - commons_io_version=2.5 - commons_lang3_version=3.6 - junit_version = "4.13" - threetenbp_version = "2.9.10" -} - dependencies { - compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile 'io.swagger:swagger-annotations:1.5.24' compile "com.google.code.findbugs:jsr305:3.0.2" - compile "org.glassfish.jersey.core:jersey-client:$jersey_version" - compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" - compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" - compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" - compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" - compile "commons-io:commons-io:$commons_io_version" - compile "org.apache.commons:commons-lang3:$commons_lang3_version" - compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" - compile "com.brsanthu:migbase64:2.2" - testCompile "junit:junit:$junit_version" + compile 'com.squareup.okhttp3:okhttp:3.14.7' + compile 'com.squareup.okhttp3:logging-interceptor:3.14.7' + compile 'com.google.code.gson:gson:2.8.6' + compile 'io.gsonfire:gson-fire:1.8.4' + compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' + compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.10' + compile 'org.threeten:threetenbp:1.4.3' + testCompile 'junit:junit:4.13' } javadoc { diff --git a/samples/client/petstore/java/jersey2-java6/build.sbt b/samples/client/petstore/java/jersey2-java6/build.sbt index e002c64a04bc..3599c49b7386 100644 --- a/samples/client/petstore/java/jersey2-java6/build.sbt +++ b/samples/client/petstore/java/jersey2-java6/build.sbt @@ -9,17 +9,16 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.22", - "org.glassfish.jersey.core" % "jersey-client" % "2.6", - "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.6", - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.6", - "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - "com.brsanthu" % "migbase64" % "2.2", - "org.apache.commons" % "commons-lang3" % "3.6", - "commons-io" % "commons-io" % "2.5", + "io.swagger" % "swagger-annotations" % "1.5.24", + "com.squareup.okhttp3" % "okhttp" % "3.14.7", + "com.squareup.okhttp3" % "logging-interceptor" % "3.14.7", + "com.google.code.gson" % "gson" % "2.8.6", + "org.apache.commons" % "commons-lang3" % "3.10", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", + "org.threeten" % "threetenbp" % "1.4.3" % "compile", + "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", + "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", "junit" % "junit" % "4.13" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md index 059616ec6baa..0565c2589b3c 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md @@ -7,9 +7,8 @@ Method | HTTP request | Description [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags - -## call123testSpecialTags - + +# **call123testSpecialTags** > Client call123testSpecialTags(body) To test special tags @@ -17,7 +16,6 @@ To test special tags To test special tags and operation ID starting with number ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -27,29 +25,28 @@ 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"); + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); - Client body = new Client(); // Client | client model - try { - Client result = apiInstance.call123testSpecialTags(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(); - } + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(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 ------------- | ------------- | ------------- | ------------- **body** | [**Client**](Client.md)| client model | @@ -64,11 +61,11 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/json -- **Accept**: application/json + - **Content-Type**: application/json + - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | +**200** | successful operation | - | diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md index 543c51f066c5..b8c2112acb88 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md @@ -20,9 +20,8 @@ Method | HTTP request | Description [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | - -## createXmlItem - + +# **createXmlItem** > createXmlItem(xmlItem) creates an XmlItem @@ -30,7 +29,6 @@ creates an XmlItem this route creates an XmlItem ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -40,28 +38,27 @@ 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"); + 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(); - } + 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 | @@ -76,17 +73,16 @@ 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 + - **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 +**200** | successful operation | - | + +# **fakeOuterBooleanSerialize** > Boolean fakeOuterBooleanSerialize(body) @@ -94,7 +90,6 @@ No authorization required Test serialization of outer boolean types ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -104,29 +99,28 @@ 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"); + 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(); - } + 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] @@ -141,17 +135,16 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: */* + - **Content-Type**: Not defined + - **Accept**: */* ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | Output boolean | - | - - -## fakeOuterCompositeSerialize +**200** | Output boolean | - | + +# **fakeOuterCompositeSerialize** > OuterComposite fakeOuterCompositeSerialize(body) @@ -159,7 +152,6 @@ No authorization required Test serialization of object with outer number type ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -169,29 +161,28 @@ 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"); + 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(); - } + 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] @@ -206,17 +197,16 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: */* + - **Content-Type**: Not defined + - **Accept**: */* ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | Output composite | - | - - -## fakeOuterNumberSerialize +**200** | Output composite | - | + +# **fakeOuterNumberSerialize** > BigDecimal fakeOuterNumberSerialize(body) @@ -224,7 +214,6 @@ No authorization required Test serialization of outer number types ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -234,29 +223,28 @@ 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"); + 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(); // 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(); - } + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // 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] @@ -271,17 +259,16 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: */* + - **Content-Type**: Not defined + - **Accept**: */* ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | Output number | - | - - -## fakeOuterStringSerialize +**200** | Output number | - | + +# **fakeOuterStringSerialize** > String fakeOuterStringSerialize(body) @@ -289,7 +276,6 @@ No authorization required Test serialization of outer string types ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -299,29 +285,28 @@ 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"); + 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(); - } + 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] @@ -336,25 +321,23 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: */* + - **Content-Type**: Not defined + - **Accept**: */* ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | Output string | - | - - -## testBodyWithFileSchema +**200** | Output string | - | + +# **testBodyWithFileSchema** > testBodyWithFileSchema(body) -For this test, the body for this request much reference a schema named `File`. +For this test, the body for this request much reference a schema named `File`. ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -364,28 +347,27 @@ 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"); + 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(); - } + 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)| | @@ -400,23 +382,21 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/json -- **Accept**: Not defined + - **Content-Type**: application/json + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | Success | - | - - -## testBodyWithQueryParams +**200** | Success | - | + +# **testBodyWithQueryParams** > testBodyWithQueryParams(query, body) ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -426,29 +406,28 @@ 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"); + 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(); - } + 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**| | @@ -464,25 +443,23 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/json -- **Accept**: Not defined + - **Content-Type**: application/json + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | Success | - | - - -## testClientModel +**200** | Success | - | + +# **testClientModel** > Client testClientModel(body) To test \"client\" model -To test "client" model +To test \"client\" model ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -492,29 +469,28 @@ 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"); + 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(); - } + 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 | @@ -529,28 +505,23 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/json -- **Accept**: application/json + - **Content-Type**: application/json + - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | - - -## testEndpointParameters +**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 - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -561,46 +532,45 @@ 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"); + 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(); // 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 = new LocalDate(); // LocalDate | None - OffsetDateTime dateTime = new OffsetDateTime(); // 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(); - } + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // 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 = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // 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 | @@ -628,18 +598,17 @@ null (empty response body) ### HTTP request headers -- **Content-Type**: application/x-www-form-urlencoded -- **Accept**: Not defined + - **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 +**400** | Invalid username supplied | - | +**404** | User not found | - | + +# **testEnumParameters** > testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) To test enum parameters @@ -647,7 +616,6 @@ To test enum parameters To test enum parameters ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -657,35 +625,34 @@ 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"); + 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 = "-efg"; // String | Header parameter enum test (string) - List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) - String enumQueryString = "-efg"; // String | Query parameter enum test (string) - Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) - Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) - List enumFormStringArray = "$"; // List | Form parameter enum test (string array) - String enumFormString = "-efg"; // 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(); - } + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // 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: >, $] @@ -707,26 +674,24 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/x-www-form-urlencoded -- **Accept**: Not defined + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **400** | Invalid request | - | -| **404** | Not found | - | +**400** | Invalid request | - | +**404** | Not found | - | - -## testGroupParameters - -> testGroupParameters().requiredStringGroup(requiredStringGroup).requiredBooleanGroup(requiredBooleanGroup).requiredInt64Group(requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +# **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; @@ -736,40 +701,36 @@ 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"); + 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 { - api.testGroupParameters() - .requiredStringGroup(requiredStringGroup) - .requiredBooleanGroup(requiredBooleanGroup) - .requiredInt64Group(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(); - } + 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 | @@ -789,23 +750,21 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **400** | Someting wrong | - | - - -## testInlineAdditionalProperties +**400** | Someting wrong | - | + +# **testInlineAdditionalProperties** > testInlineAdditionalProperties(param) test inline additionalProperties ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -815,28 +774,27 @@ 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"); + 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(); - } + 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 | @@ -851,23 +809,21 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/json -- **Accept**: Not defined + - **Content-Type**: application/json + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | - - -## testJsonFormData +**200** | successful operation | - | + +# **testJsonFormData** > testJsonFormData(param, param2) test json serialization of form data ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -877,29 +833,28 @@ 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"); + 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(); - } + 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 | @@ -915,17 +870,16 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/x-www-form-urlencoded -- **Accept**: Not defined + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | - - -## testQueryParameterCollectionFormat +**200** | successful operation | - | + +# **testQueryParameterCollectionFormat** > testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) @@ -933,7 +887,6 @@ No authorization required To test the collection format in query parameters ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -943,32 +896,31 @@ 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"); + 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(); - } + 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)| | @@ -987,11 +939,11 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | Success | - | +**200** | Success | - | diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md index 14a74a37a4e2..bd934e360718 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md @@ -7,9 +7,8 @@ Method | HTTP request | Description [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case - -## testClassname - + +# **testClassname** > Client testClassname(body) To test class name in snake case @@ -17,7 +16,6 @@ To test class name in snake case To test class name in snake case ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -28,35 +26,34 @@ 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"); + 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(); - } + 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 | @@ -71,11 +68,11 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: application/json -- **Accept**: application/json + - **Content-Type**: application/json + - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | +**200** | successful operation | - | diff --git a/samples/client/petstore/java/jersey2-java6/docs/PetApi.md b/samples/client/petstore/java/jersey2-java6/docs/PetApi.md index 875a8e6783e9..ca6658ce094a 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/PetApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/PetApi.md @@ -15,15 +15,13 @@ Method | HTTP request | Description [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) - -## addPet - + +# **addPet** > addPet(body) Add a new pet to the store ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -34,32 +32,31 @@ 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"); + 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(); - } + 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 | @@ -74,24 +71,22 @@ null (empty response body) ### HTTP request headers -- **Content-Type**: application/json, application/xml -- **Accept**: Not defined + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | -| **405** | Invalid input | - | - - -## deletePet +**200** | successful operation | - | +**405** | Invalid input | - | + +# **deletePet** > deletePet(petId, apiKey) Deletes a pet ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -102,33 +97,32 @@ 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"); + 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(); - } + 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 | @@ -144,18 +138,17 @@ null (empty response body) ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | -| **400** | Invalid pet value | - | - - -## findPetsByStatus +**200** | successful operation | - | +**400** | Invalid pet value | - | + +# **findPetsByStatus** > List<Pet> findPetsByStatus(status) Finds Pets by status @@ -163,7 +156,6 @@ Finds Pets by status Multiple status values can be provided with comma separated strings ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -174,33 +166,32 @@ 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"); + 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(); - } + 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] @@ -215,18 +206,17 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: application/xml, application/json + - **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 +**200** | successful operation | - | +**400** | Invalid status value | - | + +# **findPetsByTags** > List<Pet> findPetsByTags(tags) Finds Pets by tags @@ -234,7 +224,6 @@ 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; @@ -245,33 +234,32 @@ 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"); + 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(); - } + 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 | @@ -286,18 +274,17 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: application/xml, application/json + - **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 +**200** | successful operation | - | +**400** | Invalid tag value | - | + +# **getPetById** > Pet getPetById(petId) Find pet by ID @@ -305,7 +292,6 @@ Find pet by ID Returns a single pet ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -316,35 +302,34 @@ 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"); + 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(); - } + 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 | @@ -359,25 +344,23 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: application/xml, application/json + - **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 +**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; @@ -388,32 +371,31 @@ 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"); + 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(); - } + 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 | @@ -428,26 +410,24 @@ null (empty response body) ### HTTP request headers -- **Content-Type**: application/json, application/xml -- **Accept**: Not defined + - **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 +**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; @@ -458,34 +438,33 @@ 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"); + 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(); - } + 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 | @@ -502,23 +481,21 @@ null (empty response body) ### HTTP request headers -- **Content-Type**: application/x-www-form-urlencoded -- **Accept**: Not defined + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **405** | Invalid input | - | - - -## uploadFile +**405** | Invalid input | - | + +# **uploadFile** > ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -529,35 +506,34 @@ 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"); + 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(); - } + 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 | @@ -574,23 +550,21 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: multipart/form-data -- **Accept**: application/json + - **Content-Type**: multipart/form-data + - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | - - -## uploadFileWithRequiredFile +**200** | successful operation | - | + +# **uploadFileWithRequiredFile** > ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) uploads an image (required) ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -601,35 +575,34 @@ 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"); + 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(); - } + 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 | @@ -646,11 +619,11 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: multipart/form-data -- **Accept**: application/json + - **Content-Type**: multipart/form-data + - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | +**200** | successful operation | - | diff --git a/samples/client/petstore/java/jersey2-java6/docs/StoreApi.md b/samples/client/petstore/java/jersey2-java6/docs/StoreApi.md index 6625d5969ee4..a86b478e55ab 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/StoreApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/StoreApi.md @@ -10,17 +10,15 @@ Method | HTTP request | Description [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet - -## deleteOrder - + +# **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 +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; @@ -30,28 +28,27 @@ 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"); + 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(); - } + 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 | @@ -66,18 +63,17 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **400** | Invalid ID supplied | - | -| **404** | Order not found | - | - - -## getInventory +**400** | Invalid ID supplied | - | +**404** | Order not found | - | + +# **getInventory** > Map<String, Integer> getInventory() Returns pet inventories by status @@ -85,7 +81,6 @@ Returns pet inventories by status Returns a map of status codes to quantities ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -96,33 +91,32 @@ 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"); + 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(); - } + 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 @@ -135,25 +129,23 @@ This endpoint does not need any parameter. ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: application/json + - **Content-Type**: Not defined + - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | - - -## getOrderById +**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 generated exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -163,29 +155,28 @@ 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"); + 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(); - } + 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 | @@ -200,25 +191,23 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: application/xml, application/json + - **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 +**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; @@ -228,29 +217,28 @@ 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"); + 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(); - } + 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 | @@ -265,12 +253,12 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: application/xml, application/json + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | -| **400** | Invalid Order | - | +**200** | successful operation | - | +**400** | Invalid Order | - | diff --git a/samples/client/petstore/java/jersey2-java6/docs/UserApi.md b/samples/client/petstore/java/jersey2-java6/docs/UserApi.md index ca9f550c3167..7a90fb438b19 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/UserApi.md @@ -14,9 +14,8 @@ Method | HTTP request | Description [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user - -## createUser - + +# **createUser** > createUser(body) Create user @@ -24,7 +23,6 @@ Create user This can only be done by the logged in user. ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -34,28 +32,27 @@ 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"); + 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(); - } + 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 | @@ -70,23 +67,21 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **0** | successful operation | - | - - -## createUsersWithArrayInput +**0** | successful operation | - | + +# **createUsersWithArrayInput** > createUsersWithArrayInput(body) Creates list of users with given input array ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -96,28 +91,27 @@ 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"); + 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(); - } + 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 | @@ -132,23 +126,21 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **0** | successful operation | - | - - -## createUsersWithListInput +**0** | successful operation | - | + +# **createUsersWithListInput** > createUsersWithListInput(body) Creates list of users with given input array ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -158,28 +150,27 @@ 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"); + 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(); - } + 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 | @@ -194,17 +185,16 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **0** | successful operation | - | - - -## deleteUser +**0** | successful operation | - | + +# **deleteUser** > deleteUser(username) Delete user @@ -212,7 +202,6 @@ Delete user This can only be done by the logged in user. ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -222,28 +211,27 @@ 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"); + 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(); - } + 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 | @@ -258,24 +246,22 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **400** | Invalid username supplied | - | -| **404** | User not found | - | - - -## getUserByName +**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; @@ -285,29 +271,28 @@ 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"); + 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(); - } + 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. | @@ -322,25 +307,23 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: application/xml, application/json + - **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 +**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; @@ -350,30 +333,29 @@ 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"); + 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(); - } + 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 | @@ -389,24 +371,22 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: application/xml, application/json + - **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 +**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; @@ -416,26 +396,25 @@ 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"); + 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(); - } + 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 @@ -448,17 +427,16 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **0** | successful operation | - | - - -## updateUser +**0** | successful operation | - | + +# **updateUser** > updateUser(username, body) Updated user @@ -466,7 +444,6 @@ Updated user This can only be done by the logged in user. ### Example - ```java // Import classes: import org.openapitools.client.ApiClient; @@ -476,29 +453,28 @@ 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"); + 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(); - } + 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 | @@ -514,12 +490,12 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **400** | Invalid user supplied | - | -| **404** | User not found | - | +**400** | Invalid user supplied | - | +**404** | User not found | - | diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index 165978e4d3b2..99a1d8ff27d2 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -33,6 +33,20 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + org.apache.maven.plugins maven-enforcer-plugin @@ -88,7 +102,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.6 + 2.2 @@ -132,22 +146,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 1.6 - 1.6 - true - 128m - 512m - - -Xlint:all - -J-Xss4m - - - org.apache.maven.plugins maven-javadoc-plugin @@ -215,64 +213,38 @@ io.swagger swagger-annotations - ${swagger-annotations-version} + ${swagger-core-version} - com.google.code.findbugs jsr305 3.0.2 - - - org.glassfish.jersey.core - jersey-client - ${jersey-version} + com.squareup.okhttp3 + okhttp + ${okhttp-version} - org.glassfish.jersey.media - jersey-media-multipart - ${jersey-version} + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} - org.glassfish.jersey.media - jersey-media-json-jackson - ${jersey-version} - - - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} + com.google.code.gson + gson + ${gson-version} - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} + io.gsonfire + gson-fire + ${gson-fire-version} - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind-version} - - - org.openapitools - jackson-databind-nullable - ${jackson-databind-nullable-version} - - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${threetenbp-version} - - - - com.brsanthu - migbase64 - 2.2 + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.1 org.apache.commons @@ -280,19 +252,14 @@ ${commons-lang3-version} - commons-io - commons-io - ${commons-io-version} + org.threeten + threetenbp + ${threetenbp-version} - org.tomitribe - tomitribe-http-signatures - ${http-signature-version} - - - com.github.scribejava - scribejava-apis - 6.9.0 + javax.annotation + javax.annotation-api + ${javax-annotation-version} @@ -303,16 +270,17 @@ - UTF-8 - 1.6.1 - 2.6 - 2.5 - 3.6 - 2.10.3 - 2.10.3 - 0.2.1 - 2.9.10 + 1.6 + ${java.version} + ${java.version} + 1.8.4 + 1.5.24 + 3.14.7 + 2.8.6 + 3.10 + 1.4.3 + 1.3.2 4.13 - 1.3 + UTF-8 diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..c10438d3c5b6 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/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 downlond processing. + * + * @param bytesRead bytes Read + * @param contentLength content lenngth of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java index e4abd9b02aa0..b4072319ad5e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java @@ -1,1146 +1,1413 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class 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 javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Form; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - -import com.github.scribejava.core.model.OAuth2AccessToken; -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.client.HttpUrlConnectorProvider; -import org.glassfish.jersey.jackson.JacksonFeature; -import org.glassfish.jersey.media.multipart.FormDataBodyPart; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.MultiPart; -import org.glassfish.jersey.media.multipart.MultiPartFeature; +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.BufferedSink; +import okio.Okio; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; +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.net.URI; -import org.apache.commons.io.FileUtils; -import org.glassfish.jersey.filter.LoggingFilter; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Map.Entry; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Date; - -import java.net.URLEncoder; - -import java.io.File; import java.io.UnsupportedEncodingException; - +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +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.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBearerAuth; -import org.openapitools.client.auth.HttpSignatureAuth; import org.openapitools.client.auth.ApiKeyAuth; import org.openapitools.client.auth.OAuth; -import org.openapitools.client.model.AbstractOpenApiSchema; - +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; public class ApiClient { - protected Map defaultHeaderMap = new HashMap(); - protected Map defaultCookieMap = new HashMap(); - 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 Map> operationServers = new HashMap>() {{ - }}; - protected Map operationServerIndex = new HashMap(); - protected Map> operationServerVariables = new HashMap>(); - protected boolean debugging = false; - protected int connectionTimeout = 0; - private int readTimeout = 0; - protected Client httpClient; - protected JSON json; - protected String tempFolderPath = null; + private String basePath = "http://petstore.swagger.io:80/v2"; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; - protected Map authentications; - protected Map authenticationLookup; + private Map authentications; - protected DateFormat dateFormat; + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; - public ApiClient() { - json = new JSON(); - httpClient = buildHttpClient(debugging); + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; - this.dateFormat = new RFC3339DateFormat(); + private OkHttpClient httpClient; + private JSON json; - // Set default User-Agent. - setUserAgent("OpenAPI-Generator/1.0.0/java"); + private HttpLoggingInterceptor loggingInterceptor; - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - 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("petstore_auth", new OAuth(basePath, "")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); + /* + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); - // Setup authentication lookup (key: authentication alias, value: authentication name) - authenticationLookup = new HashMap(); - } - - /** - * Gets the JSON instance to do JSON serialization and deserialization. - * - * @return JSON - */ - public JSON getJSON() { - return json; - } - - public Client getHttpClient() { - return httpClient; - } - - public ApiClient setHttpClient(Client httpClient) { - this.httpClient = httpClient; - return this; - } - - public String getBasePath() { - return basePath; - } - - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - setOauthBasePath(basePath); - return this; - } - - public List getServers() { - return servers; - } - - public ApiClient setServers(List servers) { - this.servers = servers; - updateBasePath(); - return this; - } - - public Integer getServerIndex() { - return serverIndex; - } - - public ApiClient setServerIndex(Integer serverIndex) { - this.serverIndex = serverIndex; - updateBasePath(); - return this; - } - - public Map getServerVariables() { - return serverVariables; - } - - public ApiClient setServerVariables(Map serverVariables) { - this.serverVariables = serverVariables; - updateBasePath(); - return this; - } - - private void updateBasePath() { - setBasePath(servers.get(serverIndex).URL(serverVariables)); - } - - private void setOauthBasePath(String basePath) { - for(Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setBasePath(basePath); - } - } - } - - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication object - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - * - * @param username Username - */ - public ApiClient setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return this; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - * - * @param password Password - */ - public ApiClient setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return this; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - */ - public ApiClient setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return this; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to configure authentications which respects aliases of API keys. - * - * @param secrets Hash map from authentication name to its secret. - */ - public ApiClient configureApiKeys(HashMap secrets) { - for (Map.Entry authEntry : authentications.entrySet()) { - Authentication auth = authEntry.getValue(); - if (auth instanceof ApiKeyAuth) { - String name = authEntry.getKey(); - // respect x-auth-id-alias property - name = authenticationLookup.containsKey(name) ? authenticationLookup.get(name) : name; - if (secrets.containsKey(name)) { - ((ApiKeyAuth) auth).setApiKey(secrets.get(name)); - } - } - } - return this; - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - */ - public ApiClient setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return this; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set bearer token for the first Bearer authentication. - * - * @param bearerToken Bearer token - */ - public ApiClient setBearerToken(String bearerToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken(bearerToken); - return this; - } - } - throw new RuntimeException("No Bearer authentication configured!"); - } - - - /** - * Helper method to set access token for the first OAuth2 authentication. - * @param accessToken Access token - */ - public ApiClient setAccessToken(String accessToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the credentials for the first OAuth2 authentication. - * - * @param clientId the client ID - * @param clientSecret the client secret - */ - public ApiClient setOauthCredentials(String clientId, String clientSecret) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setCredentials(clientId, clientSecret); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the password flow for the first OAuth2 authentication. - * - * @param username the user name - * @param password the user password - */ - public ApiClient setOauthPasswordFlow(String username, String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).usePasswordFlow(username, password); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the authorization code flow for the first OAuth2 authentication. - * - * @param code the authorization code - */ - public ApiClient setOauthAuthorizationCodeFlow(String code) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).useAuthorizationCodeFlow(code); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the scopes for the first OAuth2 authentication. - * - * @param scope the oauth scope - */ - public ApiClient setOauthScope(String scope) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setScope(scope); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * @param userAgent Http user agent - * @return API client - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return API client - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return API client - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * @return True if debugging is switched on - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return API client - */ - public ApiClient setDebugging(boolean debugging) { - this.debugging = debugging; - // Rebuild HTTP Client according to the new "debugging" value. - this.httpClient = buildHttpClient(debugging); - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default tempopary folder. - * - * @return Temp folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set temp folder path - * @param tempFolderPath Temp folder path - * @return API client - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Connect timeout (in milliseconds). - * @return Connection timeout - */ - public int getConnectTimeout() { - return connectionTimeout; - } - - /** - * Set the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * @param connectionTimeout Connection timeout in milliseconds - * @return API client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - this.connectionTimeout = connectionTimeout; - httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); - return this; - } - - /** - * read timeout (in milliseconds). - * @return Read timeout - */ - public int getReadTimeout() { - return readTimeout; - } - - /** - * Set the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * @param readTimeout Read timeout in milliseconds - * @return API client - */ - public ApiClient setReadTimeout(int readTimeout) { - this.readTimeout = readTimeout; - httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); - return this; - } - - /** - * Get the date format used to parse/format date parameters. - * @return Date format - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - * Set the date format used to parse/format date parameters. - * @param dateFormat Date format - * @return API client - */ - public ApiClient setDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - // also set the date format for model (de)serialization with Date properties - this.json.setDateFormat((DateFormat) dateFormat.clone()); - return this; - } - - /** - * Parse the given string into Date object. - * @param str String - * @return Date - */ - public Date parseDate(String str) { - try { - return dateFormat.parse(str); - } catch (java.text.ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Format the given Date object into string. - * @param date Date - * @return Date in string format - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given parameter object into string. - * @param param Object - * @return Object in string format - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDate((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { - b.append(','); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /* - * Format to {@code Pair} objects. - * @param collectionFormat Collection format - * @param name Name - * @param value Value - * @return List of pairs - */ - public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null) return params; - - Collection valueCollection; - if (value instanceof Collection) { - valueCollection = (Collection) value; - } else { - params.add(new Pair(name, parameterToString(value))); - return params; + // 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("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); } - if (valueCollection.isEmpty()){ - return params; + /* + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); } - // get the collection format (default: csv) - String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); - - // create the params based on the collection format - if ("multi".equals(format)) { - for (Object item : valueCollection) { - params.add(new Pair(name, parameterToString(item))); - } - - return params; + /* + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); } - String delimiter = ","; - - if ("csv".equals(format)) { - delimiter = ","; - } else if ("ssv".equals(format)) { - delimiter = " "; - } else if ("tsv".equals(format)) { - delimiter = "\t"; - } else if ("pipes".equals(format)) { - delimiter = "|"; + /* + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); } - StringBuilder sb = new StringBuilder() ; - for (Object item : valueCollection) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - params.add(new Pair(name, sb.substring(1))); - - return params; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON - * @param mime MIME - * @return True if the MIME type is JSON - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * @param str String - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Serialize the given Java object into string entity according the given - * Content-Type (only JSON is supported for now). - * @param obj Object - * @param formParams Form parameters - * @param contentType Context type - * @return Entity - * @throws ApiException API exception - */ - public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { - Entity entity; - if (contentType.startsWith("multipart/form-data")) { - MultiPart multiPart = new MultiPart(); - for (Entry param: formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) - .fileName(file.getName()).size(file.length()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); - } else { - FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); - } - } - entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); - } else if (contentType.startsWith("application/x-www-form-urlencoded")) { - Form form = new Form(); - for (Entry param: formParams.entrySet()) { - form.param(param.getKey(), parameterToString(param.getValue())); - } - entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); - } else { - // We let jersey handle the serialization - entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); - } - return entity; - } - - /** - * Serialize the given Java object into string according the given - * Content-Type (only JSON, HTTP form is supported for now). - * @param obj Object - * @param formParams Form parameters - * @param contentType Context type - * @return String - * @throws ApiException API exception - */ - public String serializeToString(Object obj, Map formParams, String contentType) throws ApiException { - try { - if (contentType.startsWith("multipart/form-data")) { - throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); - } else if (contentType.startsWith("application/x-www-form-urlencoded")) { - String formString = ""; - for (Entry param : formParams.entrySet()) { - formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&"; + /* + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; } - if (formString.length() == 0) { // empty string - return formString; - } else { - return formString.substring(0, formString.length() - 1); + 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"); + } } - } else { - return json.getMapper().writeValueAsString(obj); - } - } catch (Exception ex) { - throw new ApiException("Failed to perform serializeToString: " + ex.toString()); - } - } + 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()); - public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) throws ApiException{ - - Object result = null; - int matchCounter = 0; - ArrayList matchSchemas = new ArrayList<>(); - - if (schema.isNullable()) { - response.bufferEntity(); - if ("{}".equals(String.valueOf(response.readEntity(String.class))) || - "".equals(String.valueOf(response.readEntity(String.class)))) { - // schema is nullable and the response body is {} or empty string - return schema; - } + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); } - for (Map.Entry entry : schema.getSchemas().entrySet()) { - String schemaName = entry.getKey(); - GenericType schemaType = entry.getValue(); + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } - if (schemaType instanceof GenericType) { // model - try { - Object deserializedObject = deserialize(response, schemaType); - if (deserializedObject != null) { - result = deserializedObject; - matchCounter++; + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } - if ("anyOf".equals(schema.getSchemaType())) { - break; - } else if ("oneOf".equals(schema.getSchemaType())) { - matchSchemas.add(schemaName); + httpClient = builder.build(); + } + + private 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 OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + 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 Api Client + * @throws 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; + } + + 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; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public ApiClient setDateFormat(DateFormat dateFormat) { + this.json.setDateFormat(dateFormat); + return this; + } + + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + this.json.setSqlDateFormat(dateFormat); + return this; + } + + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + this.json.setOffsetDateTimeFormat(dateFormat); + return this; + } + + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + this.json.setLocalDateFormat(dateFormat); + return this; + } + + public ApiClient setLenientOnJson(boolean lenientOnJson) { + this.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!"); + } + + /** + * 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 { - throw new ApiException("Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType()); + httpClient.interceptors().remove(loggingInterceptor); + loggingInterceptor = null; } - } else { - // failed to deserialize the response in the schema provided, proceed to the next one if any - } - } catch (Exception ex) { - // failed to deserialize, do nothing and try next one (schema) } - } else {// unknown type - throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); - } - + this.debugging = debugging; + return this; } - if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf - throw new ApiException("Response body is invalid as it matches more than one schema (" + StringUtil.join(matchSchemas, ", ") + ") defined in the oneOf model: " + schema.getClass().getName()); - } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas - throw new ApiException("Response body is invalid as it doens't match any schemas (" + StringUtil.join(schema.getSchemas().keySet(), ", ") + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); - } else { // only one matched - schema.setActualInstance(result); - return schema; + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; } - } - - - - /** - * Deserialize response body to Java object according to the Content-Type. - * @param Type - * @param response Response - * @param returnType Return type - * @return Deserialize object - * @throws ApiException API exception - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, GenericType returnType) throws ApiException { - if (response == null || returnType == null) { - return null; + /** + * 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; } - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - return (T) response.readEntity(byte[].class); - } else if (returnType.getRawType() == File.class) { - // Handle file downloading. - T file = (T) downloadFileFromResponse(response); - return file; + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); } - String contentType = null; - List contentTypes = response.getHeaders().get("Content-Type"); - if (contentTypes != null && !contentTypes.isEmpty()) - contentType = String.valueOf(contentTypes.get(0)); - - // read the entity stream multiple times - response.bufferEntity(); - - return response.readEntity(returnType); - } - - /** - * Download file from the given response. - * @param response Response - * @return File - * @throws ApiException If fail to read file content from response and write to disk - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - // Java6 falls back to commons.io for file copying - FileUtils.copyToFile(response.readEntity(InputStream.class), file); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) - filename = matcher.group(1); + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; } - String prefix; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf('.'); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); } - if (tempFolderPath == null) - return File.createTempFile(prefix, suffix); - else - return File.createTempFile(prefix, suffix, new File(tempFolderPath)); - } - - /** - * Invoke API by sending HTTP request with the given options. - * - * @param Type - * @param operation The qualified name of the operation - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param accept The request's Accept header - * @param contentType The request's Content-Type header - * @param authNames The authentications to apply - * @param returnType The return type into which to deserialize the response - * @param schema An instance of the response that uses oneOf/anyOf - * @return The response body in type of string - * @throws ApiException API exception - */ - public ApiResponse invokeAPI( - String operation, - String path, - String method, - List queryParams, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String accept, - String contentType, - String[] authNames, - GenericType returnType, - AbstractOpenApiSchema schema) - throws ApiException { - - // Not using `.target(targetURL).path(path)` below, - // to support (constant) query string in `path`, e.g. "/posts?draft=1" - String targetURL; - if (operationServers.containsKey(operation)) { - Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex; - Map variables = operationServerVariables.containsKey(operation) ? - operationServerVariables.get(operation) : serverVariables; - List serverConfigurations = operationServers.get(operation); - if (index < 0 || index >= serverConfigurations.size()) { - throw new ArrayIndexOutOfBoundsException( - String.format( - "Invalid index %d when selecting the host settings. Must be less than %d", - index, serverConfigurations.size())); - } - targetURL = serverConfigurations.get(index).URL(variables) + path; - } else { - targetURL = this.basePath + path; + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; } - WebTarget target = httpClient.target(targetURL); - if (queryParams != null) { - for (Pair queryParam : queryParams) { - if (queryParam.getValue() != null) { - target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue())); + /** + * 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 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; } - Invocation.Builder invocationBuilder = target.request().accept(accept); - - for (Entry entry : cookieParams.entrySet()) { - String value = entry.getValue(); - if (value != null) { - invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); - } + /** + * 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(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } } - for (Entry entry : defaultCookieMap.entrySet()) { - String value = entry.getValue(); - if (value != null) { - invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); - } + /** + * 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; } - Entity entity = serialize(body, formParams, contentType); + /** + * 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(); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - serializeToString(body, formParams, contentType), - method, - target.getUri()); + // 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; + } - for (Entry entry : allHeaderParams.entrySet()) { - String value = entry.getValue(); - if (value != null) { - invocationBuilder = invocationBuilder.header(entry.getKey(), value); - } + // 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; } - Response response = null; + /** + * 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); + } - try { - response = sendRequest(method, invocationBuilder, entity); + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; - // If OAuth is used and a status 401 is received, renew the access token and retry the request - if (response.getStatusInfo() == Status.UNAUTHORIZED) { + 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.replaceAll(".*[/\\\\]", ""); + } + + /** + * 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, + * or matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0 || 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 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); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * 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 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(MediaType.parse(contentType), (byte[]) obj); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create(MediaType.parse(contentType), (File) obj); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(MediaType.parse(contentType), content); + } 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 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 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); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws 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 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; + } + 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 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 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 ApiException If fail to serialize the request body object + */ + public Call buildCall(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(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @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 ApiException If fail to serialize the request body object + */ + public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + final String url = buildUrl(path, queryParams, collectionQueryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + 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(MediaType.parse(contentType), ""); + } + } else { + reqBody = serialize(body, contentType); + } + + // 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 path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).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("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%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 + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { for (String authName : authNames) { - Authentication authentication = authentications.get(authName); - if (authentication instanceof OAuth) { - OAuth2AccessToken accessToken = ((OAuth) authentication).renewAccessToken(); - if (accessToken != null) { - invocationBuilder.header("Authorization", null); - invocationBuilder.header("Authorization", "Bearer " + accessToken.getAccessToken()); - response = sendRequest(method, invocationBuilder, entity); + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); } - break; - } + auth.applyToParams(queryParams, headerParams, cookieParams); } - } + } - int statusCode = response.getStatusInfo().getStatusCode(); - Map> responseHeaders = buildResponseHeaders(response); - - if (response.getStatusInfo() == Status.NO_CONTENT) { - return new ApiResponse(statusCode, responseHeaders); - } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { - if (returnType == null) return new ApiResponse(statusCode, responseHeaders); - else if (schema == null) { - return new ApiResponse(statusCode, responseHeaders, deserialize(response, returnType)); - } else { // oneOf/anyOf - return new ApiResponse( - statusCode, responseHeaders, (T) deserializeSchemas(response, schema)); + /** + * 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())); } - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = String.valueOf(response.readEntity(String.class)); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } + 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(); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); + } else { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); + } } - throw new ApiException( - response.getStatus(), message, buildResponseHeaders(response), respBody); - } - } finally { - try { - response.close(); - } catch (Exception e) { - // it's not critical, since the response object is local in method invokeAPI; that's fine, - // just continue - } + return mpBuilder.build(); } - } - private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { - Response response; - if ("POST".equals(method)) { - response = invocationBuilder.post(entity); - } else if ("PUT".equals(method)) { - response = invocationBuilder.put(entity); - } else if ("DELETE".equals(method)) { - response = invocationBuilder.method("DELETE", entity); - } else if ("PATCH".equals(method)) { - response = invocationBuilder.method("PATCH", entity); - } else { - response = invocationBuilder.method(method); + /** + * 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; + } } - return response; - } - /** - * @deprecated Add qualified name of the operation as a first parameter. - */ - @Deprecated - public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, AbstractOpenApiSchema schema) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, schema); - } - - /** - * Build the Client used to make HTTP requests. - * @param debugging Debug setting - * @return Client - */ - protected Client buildHttpClient(boolean debugging) { - final ClientConfig clientConfig = new ClientConfig(); - clientConfig.register(MultiPartFeature.class); - clientConfig.register(json); - clientConfig.register(JacksonFeature.class); - clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); - // turn off compliance validation to be able to send payloads with DELETE calls - clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); - if (debugging) { - clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true)); - } else { - // suppress warnings for payloads with DELETE calls: - java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private 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; + } + }; } - performAdditionalClientConfiguration(clientConfig); - return ClientBuilder.newClient(clientConfig); - } - protected void performAdditionalClientConfiguration(ClientConfig clientConfig) { - // No-op extension point - } + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private 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 { + } - protected Map> buildResponseHeaders(Response response) { - Map> responseHeaders = new HashMap>(); - for (Entry> entry: response.getHeaders().entrySet()) { - List values = entry.getValue(); - List headers = new ArrayList(); - for (Object o : values) { - headers.add(String.valueOf(o)); - } - responseHeaders.put(entry.getKey(), headers); + @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" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + 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); + } } - return responseHeaders; - } - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - * @param method HTTP method (e.g. POST) - * @param uri HTTP URI - */ - protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, - Map cookieParams, String payload, String method, URI uri) throws ApiException { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - throw new RuntimeException("Authentication undefined: " + authName); - } - auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + private 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); + } } - } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiException.java index 3612265bc619..6c91e35f27a9 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiException.java @@ -16,9 +16,6 @@ package org.openapitools.client; import java.util.Map; import java.util.List; -/** - * API Exception - */ public class ApiException extends Exception { private int code = 0; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiResponse.java index 5f3daf26600c..9bb5cac17b41 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiResponse.java @@ -22,9 +22,9 @@ import java.util.Map; * @param The type of data that is deserialized from response body */ public class ApiResponse { - private final int statusCode; - private final Map> headers; - private final T data; + final private int statusCode; + final private Map> headers; + final private T data; /** * @param statusCode The status code of HTTP response @@ -45,29 +45,14 @@ public class ApiResponse { this.data = data; } - /** - * Get the status code - * - * @return status code - */ public int getStatusCode() { return statusCode; } - /** - * Get the headers - * - * @return map of headers - */ public Map> getHeaders() { return headers; } - /** - * Get the data - * - * @return data - */ public T getData() { return data; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/GzipRequestInterceptor.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/GzipRequestInterceptor.java new file mode 100644 index 000000000000..63442a34f40a --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/GzipRequestInterceptor.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; + +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/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/JSON.java index 1887d6c8851a..08bf82ccae6f 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/JSON.java @@ -1,54 +1,442 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class 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.threeten.bp.*; -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.*; -import org.openapitools.jackson.nullable.JsonNullableModule; -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; +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 org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.openapitools.client.model.*; +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; -import javax.ws.rs.ext.ContextResolver; +public class JSON { + private Gson gson; + private boolean isLenientOnJson = false; + private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + .registerTypeSelector(Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", BigCat.class); + classByDiscriminatorValue.put("Cat", Cat.class); + classByDiscriminatorValue.put("Dog", Dog.class); + classByDiscriminatorValue.put("Animal", Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }) + .registerTypeSelector(BigCat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", BigCat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }) + .registerTypeSelector(Cat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", BigCat.class); + classByDiscriminatorValue.put("Cat", Cat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }) + .registerTypeSelector(Dog.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog", Dog.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }) + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } -public class JSON implements ContextResolver { - private ObjectMapper mapper; + 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(); + } - public JSON() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); - mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - mapper.setDateFormat(new RFC3339DateFormat()); - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - mapper.registerModule(module); - JsonNullableModule jnm = new JsonNullableModule(); - mapper.registerModule(jnm); - } + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + 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; + } - /** - * Set the date format for JSON (de)serialization with Date properties. - * @param dateFormat Date format - */ - public void setDateFormat(DateFormat dateFormat) { - mapper.setDateFormat(dateFormat); - } + public JSON() { + gson = createGson() + .registerTypeAdapter(Date.class, dateTypeAdapter) + .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .registerTypeAdapter(byte[].class, byteArrayAdapter) + .create(); + } - @Override - public ObjectMapper getContext(Class type) { - return mapper; - } + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + * @return JSON + */ + public JSON setGson(Gson gson) { + this.gson = gson; + return this; + } + + public JSON setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + return this; + } + + /** + * 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)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public 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 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); + } + } + } + + public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + 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 + * If the dateFormat is null, ISO8601Utils will be used. + */ + 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); + } + } + } + + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } - /** - * Get the object mapper - * - * @return object mapper - */ - public ObjectMapper getMapper() { return mapper; } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..924dd8668973 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/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/jersey2-java6/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..1235d56f9fda --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ProgressResponseBody.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 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/jersey2-java6/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 0fac43ffba33..7dc96ac1afb8 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -1,115 +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.api; -import org.openapitools.client.ApiException; +import org.openapitools.client.ApiCallback; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; 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.ws.rs.core.GenericType; 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 apiClient; + private ApiClient localVarApiClient; - public AnotherFakeApi() { - this(Configuration.getDefaultApiClient()); - } - - public AnotherFakeApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API cilent - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API cilent - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * To test special tags - * To test special tags and operation ID starting with number - * @param body client model (required) - * @return Client - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public Client call123testSpecialTags(Client body) throws ApiException { - return call123testSpecialTagsWithHttpInfo(body).getData(); - } - - /** - * To test special tags - * To test special tags and operation ID starting with number - * @param body client model (required) - * @return ApiResponse<Client> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling call123testSpecialTags"); + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); } - - // create path and map variables - String localVarPath = "/another-fake/dummy"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + public AnotherFakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + public ApiClient getApiClient() { + return localVarApiClient; + } - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + /** + * Build call for call123testSpecialTags + * @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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsCall(Client body, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = body; - String[] localVarAuthNames = new String[] { }; + // create path and map variables + String localVarPath = "/another-fake/dummy"; - GenericType localVarReturnType = new GenericType() {}; + 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); + } - return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(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 call123testSpecialTags(Async)"); + } + + + okhttp3.Call localVarCall = call123testSpecialTagsCall(body, _callback); + return localVarCall; + + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(Client body) throws ApiException { + ApiResponse localVarResp = call123testSpecialTagsWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(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 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsAsync(Client body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java index e1195733962e..121867dd07a9 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java @@ -1,12 +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.api; -import org.openapitools.client.ApiException; +import org.openapitools.client.ApiCallback; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; 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.ws.rs.core.GenericType; import java.math.BigDecimal; import org.openapitools.client.model.Client; @@ -18,1183 +37,1887 @@ 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 apiClient; + private ApiClient localVarApiClient; - public FakeApi() { - this(Configuration.getDefaultApiClient()); - } - - public FakeApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API cilent - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API cilent - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * creates an XmlItem - * this route creates an XmlItem - * @param xmlItem XmlItem Body (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public void createXmlItem(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 fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiException { - Object localVarPostBody = xmlItem; - - // verify the required parameter 'xmlItem' is set - if (xmlItem == null) { - throw new ApiException(400, "Missing the required parameter 'xmlItem' when calling createXmlItem"); + public FakeApi() { + this(Configuration.getDefaultApiClient()); } - - // create path and map variables - String localVarPath = "/fake/create_xml_item"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/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 = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.createXmlItem", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * - * Test serialization of outer boolean types - * @param body Input boolean as post body (optional) - * @return Boolean - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Output boolean -
- */ - public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { - return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); - } - - /** - * - * Test serialization of outer boolean types - * @param body Input boolean as post body (optional) - * @return ApiResponse<Boolean> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Output boolean -
- */ - public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/fake/outer/boolean"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "*/*" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * - * Test serialization of object with outer number type - * @param body Input composite as post body (optional) - * @return OuterComposite - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Output composite -
- */ - public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { - return fakeOuterCompositeSerializeWithHttpInfo(body).getData(); - } - - /** - * - * Test serialization of object with outer number type - * @param body Input composite as post body (optional) - * @return ApiResponse<OuterComposite> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Output composite -
- */ - public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/fake/outer/composite"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "*/*" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * - * Test serialization of outer number types - * @param body Input number as post body (optional) - * @return BigDecimal - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Output number -
- */ - public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { - return fakeOuterNumberSerializeWithHttpInfo(body).getData(); - } - - /** - * - * Test serialization of outer number types - * @param body Input number as post body (optional) - * @return ApiResponse<BigDecimal> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Output number -
- */ - public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/fake/outer/number"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "*/*" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * - * Test serialization of outer string types - * @param body Input string as post body (optional) - * @return String - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Output string -
- */ - public String fakeOuterStringSerialize(String body) throws ApiException { - return fakeOuterStringSerializeWithHttpInfo(body).getData(); - } - - /** - * - * Test serialization of outer string types - * @param body Input string as post body (optional) - * @return ApiResponse<String> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Output string -
- */ - public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/fake/outer/string"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "*/*" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * - * For this test, the body for this request much reference a schema named `File`. - * @param body (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Success -
- */ - public void testBodyWithFileSchema(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 fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Success -
- */ - public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithFileSchema"); + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; } - - // create path and map variables - String localVarPath = "/fake/body-with-file-schema"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * - * - * @param query (required) - * @param body (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Success -
- */ - public void testBodyWithQueryParams(String query, User body) throws ApiException { - testBodyWithQueryParamsWithHttpInfo(query, body); - } - - /** - * - * - * @param query (required) - * @param body (required) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 Success -
- */ - public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'query' is set - if (query == null) { - throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + public ApiClient getApiClient() { + return localVarApiClient; } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); - } - - // create path and map variables - String localVarPath = "/fake/body-with-query-params"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * To test \"client\" model - * To test \"client\" model - * @param body client model (required) - * @return Client - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public Client testClientModel(Client body) throws ApiException { - return testClientModelWithHttpInfo(body).getData(); - } - - /** - * To test \"client\" model - * To test \"client\" model - * @param body client model (required) - * @return ApiResponse<Client> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel"); - } - - // create path and map variables - String localVarPath = "/fake"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * @param number None (required) - * @param _double None (required) - * @param patternWithoutDelimiter None (required) - * @param _byte None (required) - * @param integer None (optional) - * @param int32 None (optional) - * @param int64 None (optional) - * @param _float None (optional) - * @param string None (optional) - * @param binary None (optional) - * @param date None (optional) - * @param dateTime None (optional) - * @param password None (optional) - * @param paramCallback None (optional) - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
- */ - public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); - } - - /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * @param number None (required) - * @param _double None (required) - * @param patternWithoutDelimiter None (required) - * @param _byte None (required) - * @param integer None (optional) - * @param int32 None (optional) - * @param int64 None (optional) - * @param _float None (optional) - * @param string None (optional) - * @param binary None (optional) - * @param date None (optional) - * @param dateTime None (optional) - * @param password None (optional) - * @param paramCallback None (optional) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
- */ - public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'number' is set - if (number == null) { - throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); - } - - // verify the required parameter '_double' is set - if (_double == null) { - throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); - } - - // verify the required parameter 'patternWithoutDelimiter' is set - if (patternWithoutDelimiter == null) { - throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); - } - - // verify the required parameter '_byte' is set - if (_byte == null) { - throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); - } - - // create path and map variables - String localVarPath = "/fake"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - if (integer != null) - localVarFormParams.put("integer", integer); -if (int32 != null) - localVarFormParams.put("int32", int32); -if (int64 != null) - localVarFormParams.put("int64", int64); -if (number != null) - localVarFormParams.put("number", number); -if (_float != null) - localVarFormParams.put("float", _float); -if (_double != null) - localVarFormParams.put("double", _double); -if (string != null) - localVarFormParams.put("string", string); -if (patternWithoutDelimiter != null) - localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); -if (_byte != null) - localVarFormParams.put("byte", _byte); -if (binary != null) - localVarFormParams.put("binary", binary); -if (date != null) - localVarFormParams.put("date", date); -if (dateTime != null) - localVarFormParams.put("dateTime", dateTime); -if (password != null) - localVarFormParams.put("password", password); -if (paramCallback != null) - localVarFormParams.put("callback", paramCallback); - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "http_basic_test" }; - - return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * To test enum parameters - * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) - * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) - * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) - * @param enumQueryInteger Query parameter enum test (double) (optional) - * @param enumQueryDouble Query parameter enum test (double) (optional) - * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) - * @param enumFormString Form parameter enum test (string) (optional, default to -efg) - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid request -
404 Not found -
- */ - public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { - testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); - } - - /** - * To test enum parameters - * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) - * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) - * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) - * @param enumQueryInteger Query parameter enum test (double) (optional) - * @param enumQueryDouble Query parameter enum test (double) (optional) - * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) - * @param enumFormString Form parameter enum test (string) (optional, default to -efg) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid request -
404 Not found -
- */ - public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/fake"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); - - if (enumHeaderStringArray != null) - localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); -if (enumHeaderString != null) - localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); - - - if (enumFormStringArray != null) - localVarFormParams.put("enum_form_string_array", enumFormStringArray); -if (enumFormString != null) - localVarFormParams.put("enum_form_string", enumFormString); - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - -private ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'requiredStringGroup' is set - if (requiredStringGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); - } - - // verify the required parameter 'requiredBooleanGroup' is set - if (requiredBooleanGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); - } - - // verify the required parameter 'requiredInt64Group' is set - if (requiredInt64Group == null) { - throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); - } - - // create path and map variables - String localVarPath = "/fake"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "string_group", stringGroup)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "int64_group", int64Group)); - - if (requiredBooleanGroup != null) - localVarHeaderParams.put("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); -if (booleanGroup != null) - localVarHeaderParams.put("boolean_group", apiClient.parameterToString(booleanGroup)); - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - - public class APItestGroupParametersRequest { - private Integer requiredStringGroup; - private Boolean requiredBooleanGroup; - private Long requiredInt64Group; - private Integer stringGroup; - private Boolean booleanGroup; - private Long int64Group; - - private APItestGroupParametersRequest() { + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; } /** - * Set requiredStringGroup + * 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call createXmlItemCall(XmlItem xmlItem, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createXmlItemValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = createXmlItemCall(xmlItem, _callback); + return localVarCall; + + } + + /** + * 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void createXmlItem(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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse createXmlItemWithHttpInfo(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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call createXmlItemAsync(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 + + + +
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeCall(Boolean body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(Boolean body, final ApiCallback _callback) throws ApiException { + + + okhttp3.Call localVarCall = fakeOuterBooleanSerializeCall(body, _callback); + return localVarCall; + + } + + /** + * + * 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 + + + +
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(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 + + + +
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(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 + + + +
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeAsync(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 + + + +
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeCall(OuterComposite body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(OuterComposite body, final ApiCallback _callback) throws ApiException { + + + okhttp3.Call localVarCall = fakeOuterCompositeSerializeCall(body, _callback); + return localVarCall; + + } + + /** + * + * 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 + + + +
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(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 + + + +
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(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 + + + +
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeAsync(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 + + + +
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeCall(BigDecimal body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(BigDecimal body, final ApiCallback _callback) throws ApiException { + + + okhttp3.Call localVarCall = fakeOuterNumberSerializeCall(body, _callback); + return localVarCall; + + } + + /** + * + * 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 + + + +
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(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 + + + +
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(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 + + + +
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeAsync(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 + + + +
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeCall(String body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(String body, final ApiCallback _callback) throws ApiException { + + + okhttp3.Call localVarCall = fakeOuterStringSerializeCall(body, _callback); + return localVarCall; + + } + + /** + * + * 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 + + + +
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(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 + + + +
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(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 + + + +
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeAsync(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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaCall(FileSchemaTestClass body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = testBodyWithFileSchemaCall(body, _callback); + return localVarCall; + + } + + /** + * + * 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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaAsync(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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsCall(String query, User body, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(String query, 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)"); + } + + + okhttp3.Call localVarCall = testBodyWithQueryParamsCall(query, body, _callback); + return localVarCall; + + } + + /** + * + * + * @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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(String query, 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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, 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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsAsync(String query, 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelCall(Client body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClientModelValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = testClientModelCall(body, _callback); + return localVarCall; + + } + + /** + * 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelAsync(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 + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEndpointParametersValidateBeforeCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, 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)"); + } + + + okhttp3.Call localVarCall = testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @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 + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + 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 + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersAsync(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, 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 + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + 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)); + } + + Map localVarHeaderParams = new HashMap(); + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); + } + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); + } + + 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); + } + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEnumParametersValidateBeforeCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ApiCallback _callback) throws ApiException { + + + okhttp3.Call localVarCall = testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { + testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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 + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { + 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 + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersAsync(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, 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(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + 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)); + } + + Map localVarHeaderParams = new HashMap(); + if (requiredBooleanGroup != null) { + localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); + } + + if (booleanGroup != null) { + localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); + } + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testGroupParametersValidateBeforeCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, 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)"); + } + + + okhttp3.Call localVarCall = testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + return localVarCall; + + } + + + private ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, 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 { + private final Integer requiredStringGroup; + private final Boolean requiredBooleanGroup; + private final Long requiredInt64Group; + private Integer stringGroup; + private Boolean booleanGroup; + private Long int64Group; + + private APItestGroupParametersRequest(Integer requiredStringGroup, Boolean requiredBooleanGroup, 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(Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * 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 + + + +
Status Code Description Response Headers
400 Someting 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 + + + +
Status Code Description Response Headers
400 Someting 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 + + + +
Status Code Description Response Headers
400 Someting 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 + + + +
Status Code Description Response Headers
400 Someting 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) - * @return APItestGroupParametersRequest - */ - public APItestGroupParametersRequest requiredStringGroup(Integer requiredStringGroup) { - this.requiredStringGroup = requiredStringGroup; - return this; - } - - /** - * Set requiredBooleanGroup * @param requiredBooleanGroup Required Boolean in group parameters (required) - * @return APItestGroupParametersRequest - */ - public APItestGroupParametersRequest requiredBooleanGroup(Boolean requiredBooleanGroup) { - this.requiredBooleanGroup = requiredBooleanGroup; - return this; - } - - /** - * Set requiredInt64Group * @param requiredInt64Group Required Integer in group parameters (required) * @return APItestGroupParametersRequest - */ - public APItestGroupParametersRequest requiredInt64Group(Long requiredInt64Group) { - this.requiredInt64Group = requiredInt64Group; - return this; - } - - /** - * Set stringGroup - * @param stringGroup String in group parameters (optional) - * @return APItestGroupParametersRequest - */ - public APItestGroupParametersRequest stringGroup(Integer stringGroup) { - this.stringGroup = stringGroup; - return this; - } - - /** - * Set booleanGroup - * @param booleanGroup Boolean in group parameters (optional) - * @return APItestGroupParametersRequest - */ - public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) { - this.booleanGroup = booleanGroup; - return this; - } - - /** - * Set int64Group - * @param int64Group Integer in group parameters (optional) - * @return APItestGroupParametersRequest - */ - public APItestGroupParametersRequest int64Group(Long int64Group) { - this.int64Group = int64Group; - return this; - } - - /** - * Execute testGroupParameters request - - * @throws ApiException if fails to make API call * @http.response.details - - - -
Status Code Description Response Headers
400 Someting wrong -
- + + + +
Status Code Description Response Headers
400 Someting wrong -
*/ - - public void execute() throws ApiException { - this.executeWithHttpInfo().getData(); + public APItestGroupParametersRequest testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesCall(Map param, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = testInlineAdditionalPropertiesCall(param, _callback); + return localVarCall; + } /** - * Execute testGroupParameters request with HTTP info returned + * 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(Map param) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(param); + } + + /** + * test inline additionalProperties + * + * @param param request body (required) * @return ApiResponse<Void> - * @throws ApiException if fails to make API call + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - - - -
Status Code Description Response Headers
400 Someting wrong -
- + + + +
Status Code Description Response Headers
200 successful operation -
*/ - public ApiResponse executeWithHttpInfo() throws ApiException { - return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param) throws ApiException { + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(param, null); + return localVarApiClient.execute(localVarCall); } - } - /** - * Fake endpoint to test group parameters (optional) - * Fake endpoint to test group parameters (optional) - * @return testGroupParametersRequest - * @throws ApiException if fails to make API call - - - */ - public APItestGroupParametersRequest testGroupParameters() throws ApiException { - return new APItestGroupParametersRequest(); - } - /** - * test inline additionalProperties - * - * @param param request body (required) - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - + +
Status Code Description Response Headers
200 successful operation -
Status Code Description Response Headers
200 successful operation -
- */ - public void testInlineAdditionalProperties(Map param) throws ApiException { - testInlineAdditionalPropertiesWithHttpInfo(param); - } + */ + public okhttp3.Call testInlineAdditionalPropertiesAsync(Map param, final ApiCallback _callback) throws ApiException { - /** - * test inline additionalProperties - * - * @param param request body (required) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details + 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 - - + +
Status Code Description Response Headers
200 successful operation -
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param) throws ApiException { - Object localVarPostBody = param; - - // verify the required parameter 'param' is set - if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testInlineAdditionalProperties"); + */ + public okhttp3.Call testJsonFormDataCall(String param, String param2, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } - - // create path and map variables - String localVarPath = "/fake/inline-additionalProperties"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + @SuppressWarnings("rawtypes") + private okhttp3.Call testJsonFormDataValidateBeforeCall(String param, 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)"); + } + + okhttp3.Call localVarCall = testJsonFormDataCall(param, param2, _callback); + return localVarCall; - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + } - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * test json serialization of form data - * - * @param param field1 (required) - * @param param2 field2 (required) - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - + +
Status Code Description Response Headers
200 successful operation -
Status Code Description Response Headers
200 successful operation -
- */ - public void testJsonFormData(String param, String param2) throws ApiException { - testJsonFormDataWithHttpInfo(param, param2); - } + */ + public void testJsonFormData(String param, String param2) throws ApiException { + testJsonFormDataWithHttpInfo(param, param2); + } - /** - * test json serialization of form data - * - * @param param field1 (required) - * @param param2 field2 (required) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - + +
Status Code Description Response Headers
200 successful operation -
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'param' is set - if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); + */ + public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, null); + return localVarApiClient.execute(localVarCall); } - - // verify the required parameter 'param2' is set - if (param2 == null) { - throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); - } - - // create path and map variables - String localVarPath = "/fake/jsonFormData"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - if (param != null) - localVarFormParams.put("param", param); -if (param2 != null) - localVarFormParams.put("param2", param2); - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * - * To test the collection format in query parameters - * @param pipe (required) - * @param ioutil (required) - * @param http (required) - * @param url (required) - * @param context (required) - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - + +
Status Code Description Response Headers
200 Success -
Status Code Description Response Headers
200 successful operation -
- */ - public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) throws ApiException { - testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); - } + */ + public okhttp3.Call testJsonFormDataAsync(String param, String param2, final ApiCallback _callback) throws ApiException { - /** - * - * To test the collection format in query parameters - * @param pipe (required) - * @param ioutil (required) - * @param http (required) - * @param url (required) - * @param context (required) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details + 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 - - + +
Status Code Description Response Headers
200 Success -
Status Code Description Response Headers
200 Success -
- */ - public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'pipe' is set - if (pipe == null) { - throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + */ + public okhttp3.Call testQueryParameterCollectionFormatCall(List pipe, List ioutil, List http, List url, List context, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/test-query-paramters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + 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("space", "http", http)); + } + + if (url != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "url", url)); + } + + if (context != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "context", context)); + } + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } - - // verify the required parameter 'ioutil' is set - if (ioutil == null) { - throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryParameterCollectionFormatValidateBeforeCall(List pipe, List ioutil, List http, List url, 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)"); + } + + + okhttp3.Call localVarCall = testQueryParameterCollectionFormatCall(pipe, ioutil, http, url, context, _callback); + return localVarCall; + } - - // verify the required parameter 'http' is set - if (http == null) { - throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + + /** + * + * 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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) throws ApiException { + testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); } - - // verify the required parameter 'url' is set - if (url == null) { - throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + + /** + * + * 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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) throws ApiException { + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, null); + return localVarApiClient.execute(localVarCall); } - - // verify the required parameter 'context' is set - if (context == null) { - throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + + /** + * (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 + + + +
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; } - - // create path and map variables - String localVarPath = "/fake/test-query-paramters"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "pipe", pipe)); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "ioutil", ioutil)); - localVarQueryParams.addAll(apiClient.parameterToPairs("space", "http", http)); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "url", url)); - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "context", context)); - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index c3fc1748396a..fe3f9926447a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -1,115 +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.api; -import org.openapitools.client.ApiException; +import org.openapitools.client.ApiCallback; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; 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.ws.rs.core.GenericType; 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 apiClient; + private ApiClient localVarApiClient; - public FakeClassnameTags123Api() { - this(Configuration.getDefaultApiClient()); - } - - public FakeClassnameTags123Api(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API cilent - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API cilent - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * To test class name in snake case - * To test class name in snake case - * @param body client model (required) - * @return Client - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public Client testClassname(Client body) throws ApiException { - return testClassnameWithHttpInfo(body).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 fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); } - - // create path and map variables - String localVarPath = "/fake_classname_test"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + public FakeClassnameTags123Api(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + public ApiClient getApiClient() { + return localVarApiClient; + } - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + /** + * 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameCall(Client body, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = body; - String[] localVarAuthNames = new String[] { "api_key_query" }; + // create path and map variables + String localVarPath = "/fake_classname_test"; - GenericType localVarReturnType = new GenericType() {}; + 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); + } - return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "api_key_query" }; + return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClassnameValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = testClassnameCall(body, _callback); + return localVarCall; + + } + + /** + * 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameAsync(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/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java index 5d761c628c19..18c2941546db 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java @@ -1,703 +1,1152 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class 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.ApiCallback; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; 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.ws.rs.core.GenericType; 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 apiClient; + private ApiClient localVarApiClient; - public PetApi() { - this(Configuration.getDefaultApiClient()); - } - - public PetApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API cilent - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API cilent - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
- */ - public void addPet(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 fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
- */ - public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); + public PetApi() { + this(Configuration.getDefaultApiClient()); } - - // create path and map variables - String localVarPath = "/pet"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Deletes a pet - * - * @param petId Pet id to delete (required) - * @param apiKey (optional) - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
- */ - public void deletePet(Long petId, String apiKey) throws ApiException { - deletePetWithHttpInfo(petId, apiKey); - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete (required) - * @param apiKey (optional) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
- */ - public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; } - - // create path and map variables - String localVarPath = "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (apiKey != null) - localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter (required) - * @return List<Pet> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
- */ - public List findPetsByStatus(List status) throws ApiException { - return findPetsByStatusWithHttpInfo(status).getData(); - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter (required) - * @return ApiResponse<List<Pet>> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
- */ - public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'status' is set - if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + public ApiClient getApiClient() { + return localVarApiClient; } - - // create path and map variables - String localVarPath = "/pet/findByStatus"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - GenericType> localVarReturnType = new GenericType>() {}; - - return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (required) - * @return List<Pet> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
- * @deprecated - */ - @Deprecated - public List findPetsByTags(List tags) throws ApiException { - return findPetsByTagsWithHttpInfo(tags).getData(); - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (required) - * @return ApiResponse<List<Pet>> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
- * @deprecated - */ - @Deprecated - public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'tags' is set - if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; } - - // create path and map variables - String localVarPath = "/pet/findByTags"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - GenericType> localVarReturnType = new GenericType>() {}; - - return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return (required) - * @return Pet - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - - - + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
- */ - public Pet getPetById(Long petId) throws ApiException { - return getPetByIdWithHttpInfo(petId).getData(); - } + */ + public okhttp3.Call addPetCall(Pet body, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = body; - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return (required) - * @return ApiResponse<Pet> - * @throws ApiException if fails to make API call - * @http.response.details - - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
- */ - public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + // create path and map variables + String localVarPath = "/pet"; + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } - - // create path and map variables - String localVarPath = "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(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)"); + } + + okhttp3.Call localVarCall = addPetCall(body, _callback); + return localVarCall; - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
- */ - public void updatePet(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 fails to make API call - * @http.response.details - - - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
- */ - public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); } - - // create path and map variables - String localVarPath = "/pet"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - + + +
Status Code Description Response Headers
405 Invalid input -
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
- */ - public void updatePetWithForm(Long petId, String name, String status) throws ApiException { - updatePetWithFormWithHttpInfo(petId, name, status); - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
405 Invalid input -
- */ - public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + */ + public void addPet(Pet body) throws ApiException { + addPetWithHttpInfo(body); } - - // create path and map variables - String localVarPath = "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - if (name != null) - localVarFormParams.put("name", name); -if (status != null) - localVarFormParams.put("status", status); - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * uploads an image - * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ModelApiResponse - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - + + +
Status Code Description Response Headers
200 successful operation -
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
- */ - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { - return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData(); - } - - /** - * uploads an image - * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse<ModelApiResponse> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + */ + public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); } - - // create path and map variables - String localVarPath = "/pet/{petId}/uploadImage" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - if (additionalMetadata != null) - localVarFormParams.put("additionalMetadata", additionalMetadata); -if (file != null) - localVarFormParams.put("file", file); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "multipart/form-data" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * uploads an image (required) - * - * @param petId ID of pet to update (required) - * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @return ModelApiResponse - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - + + +
Status Code Description Response Headers
200 successful operation -
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
- */ - public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { - return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); - } + */ + public okhttp3.Call addPetAsync(Pet body, final ApiCallback _callback) throws ApiException { - /** - * uploads an image (required) - * - * @param petId ID of pet to update (required) - * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @return ApiResponse<ModelApiResponse> - * @throws ApiException if fails to make API call - * @http.response.details + 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 - - + + +
Status Code Description Response Headers
200 successful operation -
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
- */ - public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + */ + public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } - - // verify the required parameter 'requiredFile' is set - if (requiredFile == null) { - throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(Long petId, 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)"); + } + + + okhttp3.Call localVarCall = deletePetCall(petId, apiKey, _callback); + return localVarCall; + } - - // create path and map variables - String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + /** + * 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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public void deletePet(Long petId, String apiKey) throws ApiException { + deletePetWithHttpInfo(petId, apiKey); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } - - - if (additionalMetadata != null) - localVarFormParams.put("additionalMetadata", additionalMetadata); -if (requiredFile != null) - localVarFormParams.put("requiredFile", requiredFile); + /** + * 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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(Long petId, String apiKey, final ApiCallback _callback) throws ApiException { - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + 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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(List status, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; - final String[] localVarContentTypes = { - "multipart/form-data" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + // create path and map variables + String localVarPath = "/pet/findByStatus"; - String[] localVarAuthNames = new String[] { "petstore_auth" }; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } - GenericType localVarReturnType = new GenericType() {}; + 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); + } - return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } + final String[] localVarContentTypes = { + + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = findPetsByStatusCall(status, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(List tags, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = findPetsByTagsCall(tags, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(Long petId, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = getPetByIdCall(petId, _callback); + return localVarCall; + + } + + /** + * 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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(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 + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetCall(Pet body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = updatePetCall(body, _callback); + return localVarCall; + + } + + /** + * 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 + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(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 + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(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 + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetAsync(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 + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(Long petId, String name, String status, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(Long petId, String name, 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)"); + } + + + okhttp3.Call localVarCall = updatePetWithFormCall(petId, name, status, _callback); + return localVarCall; + + } + + /** + * 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 + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, 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 + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(Long petId, String name, 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replaceAll("\\{" + "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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, 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)"); + } + + + okhttp3.Call localVarCall = uploadFileCall(petId, additionalMetadata, file, _callback); + return localVarCall; + + } + + /** + * 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(Long petId, String additionalMetadata, 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replaceAll("\\{" + "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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, 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)"); + } + + + okhttp3.Call localVarCall = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback); + return localVarCall; + + } + + /** + * 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, 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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileAsync(Long petId, File requiredFile, 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/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java index b5ca41442db5..a75ea2ae48f3 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java @@ -1,316 +1,502 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class 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.ApiCallback; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; 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.ws.rs.core.GenericType; 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 apiClient; + private ApiClient localVarApiClient; - public StoreApi() { - this(Configuration.getDefaultApiClient()); - } - - public StoreApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API cilent - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API cilent - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
- */ - public void deleteOrder(String orderId) throws ApiException { - deleteOrderWithHttpInfo(orderId); - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
- */ - public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + public StoreApi() { + this(Configuration.getDefaultApiClient()); } - - // create path and map variables - String localVarPath = "/store/order/{order_id}" - .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return Map<String, Integer> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public Map getInventory() throws ApiException { - return getInventoryWithHttpInfo().getData(); - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return ApiResponse<Map<String, Integer>> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/inventory"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - - GenericType> localVarReturnType = new GenericType>() {}; - - return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @return Order - * @throws ApiException if fails to make API call - * @http.response.details - - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
- */ - public Order getOrderById(Long orderId) throws ApiException { - return getOrderByIdWithHttpInfo(orderId).getData(); - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @return ApiResponse<Order> - * @throws ApiException if fails to make API call - * @http.response.details - - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
- */ - public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; } - - // create path and map variables - String localVarPath = "/store/order/{order_id}" - .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet (required) - * @return Order - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
- */ - public Order placeOrder(Order body) throws ApiException { - return placeOrderWithHttpInfo(body).getData(); - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet (required) - * @return ApiResponse<Order> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
- */ - public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); + public ApiClient getApiClient() { + return localVarApiClient; } - - // create path and map variables - String localVarPath = "/store/order"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + /** + * 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 + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(String orderId, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", localVarApiClient.escapeString(orderId.toString())); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + 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); + } - String[] localVarAuthNames = new String[] { }; + final String[] localVarContentTypes = { + + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); - GenericType localVarReturnType = new GenericType() {}; + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } - return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = deleteOrderCall(orderId, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(String orderId) throws ApiException { + deleteOrderWithHttpInfo(orderId); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(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 + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(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 + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + + + okhttp3.Call localVarCall = getInventoryCall(_callback); + return localVarCall; + + } + + /** + * 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 + + + +
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 + + + +
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 + + + +
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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(Long orderId, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = getOrderByIdCall(orderId, _callback); + return localVarCall; + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(Long orderId) throws ApiException { + 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 generated 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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(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 generated 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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(Order body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = placeOrderCall(body, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(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 + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(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/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java index 4aa5531f4eb6..567006c4740e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java @@ -1,588 +1,953 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class 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.ApiCallback; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; 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.ws.rs.core.GenericType; 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 apiClient; + private ApiClient localVarApiClient; - public UserApi() { - this(Configuration.getDefaultApiClient()); - } - - public UserApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API cilent - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API cilent - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
0 successful operation -
- */ - public void createUser(User 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 fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
0 successful operation -
- */ - public ApiResponse createUserWithHttpInfo(User body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); + public UserApi() { + this(Configuration.getDefaultApiClient()); } - - // create path and map variables - String localVarPath = "/user"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Creates list of users with given input array - * - * @param body List of user object (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
0 successful operation -
- */ - public void createUsersWithArrayInput(List 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 fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
0 successful operation -
- */ - public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; } - - // create path and map variables - String localVarPath = "/user/createWithArray"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Creates list of users with given input array - * - * @param body List of user object (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
0 successful operation -
- */ - public void createUsersWithListInput(List 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 fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
0 successful operation -
- */ - public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); + public ApiClient getApiClient() { + return localVarApiClient; } - - // create path and map variables - String localVarPath = "/user/createWithList"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
- */ - public void deleteUser(String username) throws ApiException { - deleteUserWithHttpInfo(username); - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
- */ - public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; } - - // create path and map variables - String localVarPath = "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return User - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - - - + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
Status Code Description Response Headers
0 successful operation -
- */ - public User getUserByName(String username) throws ApiException { - return getUserByNameWithHttpInfo(username).getData(); - } + */ + public okhttp3.Call createUserCall(User body, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = body; - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return ApiResponse<User> - * @throws ApiException if fails to make API call - * @http.response.details - - - - - -
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
- */ - public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + // create path and map variables + String localVarPath = "/user"; + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } - - // create path and map variables - String localVarPath = "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(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)"); + } + + okhttp3.Call localVarCall = createUserCall(body, _callback); + return localVarCall; - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return String - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
- */ - public String loginUser(String username, String password) throws ApiException { - return loginUserWithHttpInfo(username, password).getData(); - } - - /** - * Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return ApiResponse<String> - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
- */ - public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); } - - // verify the required parameter 'password' is set - if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + + /** + * Create 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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(User body) throws ApiException { + createUserWithHttpInfo(body); } - - // create path and map variables - String localVarPath = "/user/login"; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - - return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); - } - /** - * Logs out current logged in user session - * - * @throws ApiException if fails to make API call - * @http.response.details + /** + * 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 - - + +
Status Code Description Response Headers
0 successful operation -
Status Code Description Response Headers
0 successful operation -
- */ - public void logoutUser() throws ApiException { - logoutUserWithHttpInfo(); - } - - /** - * Logs out current logged in user session - * - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - - - -
Status Code Description Response Headers
0 successful operation -
- */ - public ApiResponse logoutUserWithHttpInfo() throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/user/logout"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param body Updated user object (required) - * @throws ApiException if fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
- */ - public void updateUser(String username, User 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 fails to make API call - * @http.response.details - - - - -
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
- */ - public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + */ + public ApiResponse createUserWithHttpInfo(User body) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); + + /** + * 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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(User body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; } - - // create path and map variables - String localVarPath = "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + /** + * 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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(List body, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = body; - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // 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[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } - String[] localVarAuthNames = new String[] { }; + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(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 apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); - } + okhttp3.Call localVarCall = createUsersWithArrayInputCall(body, _callback); + return localVarCall; + + } + + /** + * 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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(List body, final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = createUsersWithListInputCall(body, _callback); + return localVarCall; + + } + + /** + * 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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(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 + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(String username, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = deleteUserCall(username, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(String username) throws ApiException { + deleteUserWithHttpInfo(username); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(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 + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(String username, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(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)"); + } + + + okhttp3.Call localVarCall = getUserByNameCall(username, _callback); + return localVarCall; + + } + + /** + * 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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(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 + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(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 + + + + +
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(String username, String password, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(String username, 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)"); + } + + + okhttp3.Call localVarCall = loginUserCall(username, password, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
+ */ + public String loginUser(String username, String password) throws ApiException { + 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 + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
+ */ + public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { + 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 + + + + +
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(String username, 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 + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + 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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + + + okhttp3.Call localVarCall = logoutUserCall(_callback); + return localVarCall; + + } + + /** + * 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 + + + +
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 + + + +
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 + + + +
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 + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(String username, User body, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "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); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(String username, 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)"); + } + + + okhttp3.Call localVarCall = updateUserCall(username, body, _callback); + return localVarCall; + + } + + /** + * 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 + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(String username, 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 + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(String username, 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 + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(String username, 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/jersey2-java6/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index c1b2e4840702..a9427105d811 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -14,9 +14,7 @@ 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; @@ -58,7 +56,7 @@ public class ApiKeyAuth implements Authentication { } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { if (apiKey == null) { return; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/Authentication.java index 579b5e0d6d53..5c558b1d5abd 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/Authentication.java @@ -14,9 +14,7 @@ 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; @@ -28,6 +26,5 @@ public interface Authentication { * @param headerParams Map of header parameters * @param cookieParams Map of cookie parameters */ - void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; - + void applyToParams(List queryParams, Map headerParams, Map cookieParams); } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index bf1b68d5a316..959a32116537 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -14,47 +14,41 @@ package org.openapitools.client.auth; import org.openapitools.client.Pair; -import org.openapitools.client.ApiException; -import com.migcomponents.migbase64.Base64; +import okhttp3.Credentials; -import java.net.URI; import java.util.Map; import java.util.List; import java.io.UnsupportedEncodingException; - public class HttpBasicAuth implements Authentication { - private String username; - private String password; + 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; + public String getUsername() { + return username; } - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - try { - headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); + + 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) { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); } - } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 1b46b4c6839f..e20259cb94ca 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -14,9 +14,7 @@ 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; @@ -48,7 +46,7 @@ public class HttpBearerAuth implements Authentication { } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { if(bearerToken == null) { return; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/OAuth.java index 5751094fa1db..779680c9b2f9 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/OAuth.java @@ -14,170 +14,26 @@ package org.openapitools.client.auth; import org.openapitools.client.Pair; -import org.openapitools.client.ApiException; -import com.github.scribejava.core.builder.ServiceBuilder; -import com.github.scribejava.core.builder.api.DefaultApi20; -import com.github.scribejava.core.exceptions.OAuthException; -import com.github.scribejava.core.model.OAuth2AccessToken; -import com.github.scribejava.core.oauth.OAuth20Service; -import javax.ws.rs.core.UriBuilder; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.logging.Level; -import java.util.logging.Logger; +import java.util.List; public class OAuth implements Authentication { - private static final Logger log = Logger.getLogger(OAuth.class.getName()); + private String accessToken; - private String tokenUrl; - private String absoluteTokenUrl; - private OAuthFlow flow = OAuthFlow.application; - private OAuth20Service service; - private DefaultApi20 authApi; - private String scope; - private String username; - private String password; - private String code; - private volatile OAuth2AccessToken accessToken; - - public OAuth(String basePath, String tokenUrl) { - this.tokenUrl = tokenUrl; - this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); - authApi = new DefaultApi20() { - @Override - public String getAccessTokenEndpoint() { - return absoluteTokenUrl; - } - - @Override - protected String getAuthorizationBaseUrl() { - throw new UnsupportedOperationException("Shouldn't get there !"); - } - }; + public String getAccessToken() { + return accessToken; } - private static String createAbsoluteTokenUrl(String basePath, String tokenUrl) { - if (!URI.create(tokenUrl).isAbsolute()) { - try { - return UriBuilder.fromPath(basePath).path(tokenUrl).build().toURL().toString(); - } catch (MalformedURLException e) { - log.log(Level.SEVERE, "Couldn't create absolute token URL", e); - } - } - return tokenUrl; + 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) { - obtainAccessToken(null); - } + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { if (accessToken != null) { - headerParams.put("Authorization", "Bearer " + accessToken.getAccessToken()); + headerParams.put("Authorization", "Bearer " + accessToken); } } - - public OAuth2AccessToken renewAccessToken() throws ApiException { - String refreshToken = null; - if (accessToken != null) { - refreshToken = accessToken.getRefreshToken(); - accessToken = null; - } - return obtainAccessToken(refreshToken); - } - - public synchronized OAuth2AccessToken obtainAccessToken(String refreshToken) throws ApiException { - if (service == null) { - return null; - } - try { - if (refreshToken != null) { - return service.refreshAccessToken(refreshToken); - } - } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { - log.log(Level.FINE, "Refreshing the access token using the refresh token failed", e); - } - try { - switch (flow) { - case password: - if (username != null && password != null) { - accessToken = service.getAccessTokenPasswordGrant(username, password, scope); - } - break; - case accessCode: - if (code != null) { - accessToken = service.getAccessToken(code); - code = null; - } - break; - case application: - accessToken = service.getAccessTokenClientCredentialsGrant(scope); - } - } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { - throw new ApiException(e); - } - return accessToken; - } - - public OAuth2AccessToken getAccessToken() { - return accessToken; - } - - public OAuth setAccessToken(OAuth2AccessToken accessToken) { - this.accessToken = accessToken; - return this; - } - - public OAuth setAccessToken(String accessToken) { - this.accessToken = new OAuth2AccessToken(accessToken); - return this; - } - - public OAuth setScope(String scope) { - this.scope = scope; - return this; - } - - public OAuth setCredentials(String clientId, String clientSecret) { - service = new ServiceBuilder(clientId) - .apiSecret(clientSecret) - .build(authApi); - return this; - } - - public OAuth usePasswordFlow(String username, String password) { - this.flow = OAuthFlow.password; - this.username = username; - this.password = password; - return this; - } - - public OAuth useAuthorizationCodeFlow(String code) { - this.flow = OAuthFlow.accessCode; - this.code = code; - return this; - } - - public OAuth setFlow(OAuthFlow flow) { - this.flow = flow; - return this; - } - - public void setBasePath(String basePath) { - this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); - } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..215a33f329f0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,68 @@ +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(mediaType, request.getBody()) : 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(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..9cab81a71767 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,181 @@ +package org.openapitools.client.auth; + +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.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + 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 clientSecret The OAuth2 client secret for the "clientCredentials" flow. + */ + 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 (String paramName : parameters.keySet()) { + tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); + } + } + } + + public void setFlow(OAuthFlow flow) { + switch(flow) { + case accessCode: + 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 (String headerName : headers.keySet()) { + requestBuilder.addHeader(headerName, headers.get(headerName)); + } + 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 + */ + 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()); + return !getAccessToken().equals(requestAccessToken); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + + return false; + } + + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + 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) { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 918a8b6f4c4d..3f8f85b078d3 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -14,25 +14,24 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.HashMap; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesAnyType */ -@JsonPropertyOrder({ - AdditionalPropertiesAnyType.JSON_PROPERTY_NAME -}) public class AdditionalPropertiesAnyType extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -48,8 +47,6 @@ public class AdditionalPropertiesAnyType extends HashMap { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 2d38423da848..ccf8953115d4 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -14,26 +14,25 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.HashMap; import java.util.List; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesArray */ -@JsonPropertyOrder({ - AdditionalPropertiesArray.JSON_PROPERTY_NAME -}) public class AdditionalPropertiesArray extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -49,8 +48,6 @@ public class AdditionalPropertiesArray extends HashMap { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 441c2debd6df..63978f86e60a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -14,25 +14,24 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.HashMap; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesBoolean */ -@JsonPropertyOrder({ - AdditionalPropertiesBoolean.JSON_PROPERTY_NAME -}) public class AdditionalPropertiesBoolean extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -48,8 +47,6 @@ public class AdditionalPropertiesBoolean extends HashMap { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 0ea54fca637e..58772627a0df 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -14,67 +14,66 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesClass */ -@JsonPropertyOrder({ - AdditionalPropertiesClass.JSON_PROPERTY_MAP_STRING, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_NUMBER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_INTEGER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_BOOLEAN, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_INTEGER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_ANYTYPE, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_STRING, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_ANYTYPE, - AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1, - AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE2, - AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE3 -}) public class AdditionalPropertiesClass { - public static final String JSON_PROPERTY_MAP_STRING = "map_string"; + public static final String SERIALIZED_NAME_MAP_STRING = "map_string"; + @SerializedName(SERIALIZED_NAME_MAP_STRING) private Map mapString = null; - public static final String JSON_PROPERTY_MAP_NUMBER = "map_number"; + public static final String SERIALIZED_NAME_MAP_NUMBER = "map_number"; + @SerializedName(SERIALIZED_NAME_MAP_NUMBER) private Map mapNumber = null; - public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer"; + public static final String SERIALIZED_NAME_MAP_INTEGER = "map_integer"; + @SerializedName(SERIALIZED_NAME_MAP_INTEGER) private Map mapInteger = null; - public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean"; + public static final String SERIALIZED_NAME_MAP_BOOLEAN = "map_boolean"; + @SerializedName(SERIALIZED_NAME_MAP_BOOLEAN) private Map mapBoolean = null; - public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer"; + public static final String SERIALIZED_NAME_MAP_ARRAY_INTEGER = "map_array_integer"; + @SerializedName(SERIALIZED_NAME_MAP_ARRAY_INTEGER) private Map> mapArrayInteger = null; - public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype"; + public static final String SERIALIZED_NAME_MAP_ARRAY_ANYTYPE = "map_array_anytype"; + @SerializedName(SERIALIZED_NAME_MAP_ARRAY_ANYTYPE) private Map> mapArrayAnytype = null; - public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string"; + public static final String SERIALIZED_NAME_MAP_MAP_STRING = "map_map_string"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_STRING) private Map> mapMapString = null; - public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype"; + public static final String SERIALIZED_NAME_MAP_MAP_ANYTYPE = "map_map_anytype"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_ANYTYPE) private Map> mapMapAnytype = null; - public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; + public static final String SERIALIZED_NAME_ANYTYPE1 = "anytype_1"; + @SerializedName(SERIALIZED_NAME_ANYTYPE1) private Object anytype1; - public static final String JSON_PROPERTY_ANYTYPE2 = "anytype_2"; + public static final String SERIALIZED_NAME_ANYTYPE2 = "anytype_2"; + @SerializedName(SERIALIZED_NAME_ANYTYPE2) private Object anytype2; - public static final String JSON_PROPERTY_ANYTYPE3 = "anytype_3"; + public static final String SERIALIZED_NAME_ANYTYPE3 = "anytype_3"; + @SerializedName(SERIALIZED_NAME_ANYTYPE3) private Object anytype3; @@ -98,8 +97,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getMapString() { return mapString; @@ -131,8 +128,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getMapNumber() { return mapNumber; @@ -164,8 +159,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getMapInteger() { return mapInteger; @@ -197,8 +190,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getMapBoolean() { return mapBoolean; @@ -230,8 +221,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getMapArrayInteger() { return mapArrayInteger; @@ -263,8 +252,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getMapArrayAnytype() { return mapArrayAnytype; @@ -296,8 +283,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_MAP_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getMapMapString() { return mapMapString; @@ -329,8 +314,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getMapMapAnytype() { return mapMapAnytype; @@ -354,8 +337,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE1) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getAnytype1() { return anytype1; @@ -379,8 +360,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE2) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getAnytype2() { return anytype2; @@ -404,8 +383,6 @@ public class AdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE3) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getAnytype3() { return anytype3; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index a50b957d7f87..29bd125dc589 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -14,25 +14,24 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.HashMap; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesInteger */ -@JsonPropertyOrder({ - AdditionalPropertiesInteger.JSON_PROPERTY_NAME -}) public class AdditionalPropertiesInteger extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -48,8 +47,6 @@ public class AdditionalPropertiesInteger extends HashMap { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index 99e5a1fd46ec..960ccd40cb72 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -14,26 +14,25 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; import java.util.HashMap; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesNumber */ -@JsonPropertyOrder({ - AdditionalPropertiesNumber.JSON_PROPERTY_NAME -}) public class AdditionalPropertiesNumber extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -49,8 +48,6 @@ public class AdditionalPropertiesNumber extends HashMap { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 71181f480a21..8ffa72cfbc87 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -14,25 +14,24 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.HashMap; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesObject */ -@JsonPropertyOrder({ - AdditionalPropertiesObject.JSON_PROPERTY_NAME -}) public class AdditionalPropertiesObject extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -48,8 +47,6 @@ public class AdditionalPropertiesObject extends HashMap { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 508930ed85f0..b0f752396208 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -14,25 +14,24 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.HashMap; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesString */ -@JsonPropertyOrder({ - AdditionalPropertiesString.JSON_PROPERTY_NAME -}) public class AdditionalPropertiesString extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -48,8 +47,6 @@ public class AdditionalPropertiesString extends HashMap { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java index af6245294343..a5931240e2f4 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java @@ -14,41 +14,35 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.openapitools.client.model.BigCat; import org.openapitools.client.model.Cat; import org.openapitools.client.model.Dog; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * Animal */ -@JsonPropertyOrder({ - Animal.JSON_PROPERTY_CLASS_NAME, - Animal.JSON_PROPERTY_COLOR -}) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), - @JsonSubTypes.Type(value = Cat.class, name = "Cat"), - @JsonSubTypes.Type(value = Dog.class, name = "Dog"), -}) public class Animal { - public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + protected String className; - public static final String JSON_PROPERTY_COLOR = "color"; + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) private String color = "red"; + public Animal() { + this.className = this.getClass().getSimpleName(); + } public Animal className(String className) { @@ -61,8 +55,6 @@ public class Animal { * @return className **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_CLASS_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getClassName() { return className; @@ -86,8 +78,6 @@ public class Animal { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_COLOR) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getColor() { return color; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index c658c3bf2f5c..59eb65c8a7e1 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -14,26 +14,25 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * ArrayOfArrayOfNumberOnly */ -@JsonPropertyOrder({ - ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER -}) public class ArrayOfArrayOfNumberOnly { - public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) private List> arrayArrayNumber = null; @@ -57,8 +56,6 @@ public class ArrayOfArrayOfNumberOnly { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List> getArrayArrayNumber() { return arrayArrayNumber; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index fdbd4c8a7e32..6ef174057a68 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -14,26 +14,25 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * ArrayOfNumberOnly */ -@JsonPropertyOrder({ - ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER -}) public class ArrayOfNumberOnly { - public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; + @SerializedName(SERIALIZED_NAME_ARRAY_NUMBER) private List arrayNumber = null; @@ -57,8 +56,6 @@ public class ArrayOfNumberOnly { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getArrayNumber() { return arrayNumber; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayTest.java index 6586d6dc22a0..5ac82c808024 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -14,34 +14,33 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.List; import org.openapitools.client.model.ReadOnlyFirst; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * ArrayTest */ -@JsonPropertyOrder({ - ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, - ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, - ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL -}) public class ArrayTest { - public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; + @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING) private List arrayOfString = null; - public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER) private List> arrayArrayOfInteger = null; - public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL) private List> arrayArrayOfModel = null; @@ -65,8 +64,6 @@ public class ArrayTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getArrayOfString() { return arrayOfString; @@ -98,8 +95,6 @@ public class ArrayTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; @@ -131,8 +126,6 @@ public class ArrayTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List> getArrayArrayOfModel() { return arrayArrayOfModel; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCat.java index 91aa0feff1b7..7bf07833fc6a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCat.java @@ -14,33 +14,27 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.openapitools.client.model.BigCatAllOf; import org.openapitools.client.model.Cat; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * BigCat */ -@JsonPropertyOrder({ - BigCat.JSON_PROPERTY_KIND -}) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) -@JsonSubTypes({ -}) public class BigCat extends Cat { /** * Gets or Sets kind */ + @JsonAdapter(KindEnum.Adapter.class) public enum KindEnum { LIONS("lions"), @@ -56,7 +50,6 @@ public class BigCat extends Cat { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -66,7 +59,6 @@ public class BigCat extends Cat { return String.valueOf(value); } - @JsonCreator public static KindEnum fromValue(String value) { for (KindEnum b : KindEnum.values()) { if (b.value.equals(value)) { @@ -75,11 +67,28 @@ public class BigCat extends Cat { } 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 final String JSON_PROPERTY_KIND = "kind"; + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) private KindEnum kind; + public BigCat() { + this.className = this.getClass().getSimpleName(); + } public BigCat kind(KindEnum kind) { @@ -93,8 +102,6 @@ public class BigCat extends Cat { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_KIND) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public KindEnum getKind() { return kind; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCatAllOf.java index c3b5efaddd35..c83adb667f87 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -14,25 +14,24 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * BigCatAllOf */ -@JsonPropertyOrder({ - BigCatAllOf.JSON_PROPERTY_KIND -}) public class BigCatAllOf { /** * Gets or Sets kind */ + @JsonAdapter(KindEnum.Adapter.class) public enum KindEnum { LIONS("lions"), @@ -48,7 +47,6 @@ public class BigCatAllOf { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -58,7 +56,6 @@ public class BigCatAllOf { return String.valueOf(value); } - @JsonCreator public static KindEnum fromValue(String value) { for (KindEnum b : KindEnum.values()) { if (b.value.equals(value)) { @@ -67,9 +64,23 @@ public class BigCatAllOf { } 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 final String JSON_PROPERTY_KIND = "kind"; + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) private KindEnum kind; @@ -85,8 +96,6 @@ public class BigCatAllOf { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_KIND) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public KindEnum getKind() { return kind; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Capitalization.java index 96b00573c118..38c1a3a80e9e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Capitalization.java @@ -14,43 +14,42 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * Capitalization */ -@JsonPropertyOrder({ - Capitalization.JSON_PROPERTY_SMALL_CAMEL, - Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, - Capitalization.JSON_PROPERTY_SMALL_SNAKE, - Capitalization.JSON_PROPERTY_CAPITAL_SNAKE, - Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, - Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E -}) public class Capitalization { - public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; + @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) private String smallCamel; - public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; + @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) private String capitalCamel; - public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; + @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) private String smallSnake; - public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; + @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) private String capitalSnake; - public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + 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) private String scAETHFlowPoints; - public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + 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) private String ATT_NAME; @@ -66,8 +65,6 @@ public class Capitalization { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSmallCamel() { return smallCamel; @@ -91,8 +88,6 @@ public class Capitalization { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getCapitalCamel() { return capitalCamel; @@ -116,8 +111,6 @@ public class Capitalization { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSmallSnake() { return smallSnake; @@ -141,8 +134,6 @@ public class Capitalization { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getCapitalSnake() { return capitalSnake; @@ -166,8 +157,6 @@ public class Capitalization { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getScAETHFlowPoints() { return scAETHFlowPoints; @@ -191,8 +180,6 @@ public class Capitalization { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Name of the pet ") - @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getATTNAME() { return ATT_NAME; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Cat.java index a7aad1208f2e..746f2dfe22b8 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Cat.java @@ -14,35 +14,31 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.openapitools.client.model.Animal; import org.openapitools.client.model.BigCat; import org.openapitools.client.model.CatAllOf; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * Cat */ -@JsonPropertyOrder({ - Cat.JSON_PROPERTY_DECLAWED -}) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), -}) public class Cat extends Animal { - public static final String JSON_PROPERTY_DECLAWED = "declawed"; + public static final String SERIALIZED_NAME_DECLAWED = "declawed"; + @SerializedName(SERIALIZED_NAME_DECLAWED) private Boolean declawed; + public Cat() { + this.className = this.getClass().getSimpleName(); + } public Cat declawed(Boolean declawed) { @@ -56,8 +52,6 @@ public class Cat extends Animal { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DECLAWED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isDeclawed() { return declawed; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/CatAllOf.java index 464bca0a4b5f..b2eb263c9234 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -14,23 +14,22 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * CatAllOf */ -@JsonPropertyOrder({ - CatAllOf.JSON_PROPERTY_DECLAWED -}) public class CatAllOf { - public static final String JSON_PROPERTY_DECLAWED = "declawed"; + public static final String SERIALIZED_NAME_DECLAWED = "declawed"; + @SerializedName(SERIALIZED_NAME_DECLAWED) private Boolean declawed; @@ -46,8 +45,6 @@ public class CatAllOf { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DECLAWED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isDeclawed() { return declawed; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java index 62392f4cda8d..341ca369a19c 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java @@ -14,27 +14,26 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * Category */ -@JsonPropertyOrder({ - Category.JSON_PROPERTY_ID, - Category.JSON_PROPERTY_NAME -}) public class Category { - public static final String JSON_PROPERTY_ID = "id"; + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) private Long id; - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name = "default-name"; @@ -50,8 +49,6 @@ public class Category { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getId() { return id; @@ -74,8 +71,6 @@ public class Category { * @return name **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ClassModel.java index 2cb98e618e9e..8f46328142da 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ClassModel.java @@ -14,24 +14,23 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * Model for testing model with \"_class\" property */ @ApiModel(description = "Model for testing model with \"_class\" property") -@JsonPropertyOrder({ - ClassModel.JSON_PROPERTY_PROPERTY_CLASS -}) public class ClassModel { - public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; + @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) private String propertyClass; @@ -47,8 +46,6 @@ public class ClassModel { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPropertyClass() { return propertyClass; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Client.java index f2a426f5eb50..4437f2e2b2ed 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Client.java @@ -14,23 +14,22 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * Client */ -@JsonPropertyOrder({ - Client.JSON_PROPERTY_CLIENT -}) public class Client { - public static final String JSON_PROPERTY_CLIENT = "client"; + public static final String SERIALIZED_NAME_CLIENT = "client"; + @SerializedName(SERIALIZED_NAME_CLIENT) private String client; @@ -46,8 +45,6 @@ public class Client { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_CLIENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getClient() { return client; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Dog.java index ba85bd293dc3..f1335b0455fc 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Dog.java @@ -14,33 +14,30 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.openapitools.client.model.Animal; import org.openapitools.client.model.DogAllOf; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * Dog */ -@JsonPropertyOrder({ - Dog.JSON_PROPERTY_BREED -}) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) -@JsonSubTypes({ -}) public class Dog extends Animal { - public static final String JSON_PROPERTY_BREED = "breed"; + public static final String SERIALIZED_NAME_BREED = "breed"; + @SerializedName(SERIALIZED_NAME_BREED) private String breed; + public Dog() { + this.className = this.getClass().getSimpleName(); + } public Dog breed(String breed) { @@ -54,8 +51,6 @@ public class Dog extends Animal { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BREED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getBreed() { return breed; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/DogAllOf.java index bca1adcdc9a9..97f399d823d0 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -14,23 +14,22 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * DogAllOf */ -@JsonPropertyOrder({ - DogAllOf.JSON_PROPERTY_BREED -}) public class DogAllOf { - public static final String JSON_PROPERTY_BREED = "breed"; + public static final String SERIALIZED_NAME_BREED = "breed"; + @SerializedName(SERIALIZED_NAME_BREED) private String breed; @@ -46,8 +45,6 @@ public class DogAllOf { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BREED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getBreed() { return breed; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java index 5e356ba76d35..f1497fde68c6 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -14,28 +14,26 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * EnumArrays */ -@JsonPropertyOrder({ - EnumArrays.JSON_PROPERTY_JUST_SYMBOL, - EnumArrays.JSON_PROPERTY_ARRAY_ENUM -}) public class EnumArrays { /** * Gets or Sets justSymbol */ + @JsonAdapter(JustSymbolEnum.Adapter.class) public enum JustSymbolEnum { GREATER_THAN_OR_EQUAL_TO(">="), @@ -47,7 +45,6 @@ public class EnumArrays { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -57,7 +54,6 @@ public class EnumArrays { return String.valueOf(value); } - @JsonCreator public static JustSymbolEnum fromValue(String value) { for (JustSymbolEnum b : JustSymbolEnum.values()) { if (b.value.equals(value)) { @@ -66,14 +62,29 @@ public class EnumArrays { } 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 final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; + public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; + @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum */ + @JsonAdapter(ArrayEnumEnum.Adapter.class) public enum ArrayEnumEnum { FISH("fish"), @@ -85,7 +96,6 @@ public class EnumArrays { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -95,7 +105,6 @@ public class EnumArrays { return String.valueOf(value); } - @JsonCreator public static ArrayEnumEnum fromValue(String value) { for (ArrayEnumEnum b : ArrayEnumEnum.values()) { if (b.value.equals(value)) { @@ -104,9 +113,23 @@ public class EnumArrays { } 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 final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; + public static final String SERIALIZED_NAME_ARRAY_ENUM = "array_enum"; + @SerializedName(SERIALIZED_NAME_ARRAY_ENUM) private List arrayEnum = null; @@ -122,8 +145,6 @@ public class EnumArrays { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public JustSymbolEnum getJustSymbol() { return justSymbol; @@ -155,8 +176,6 @@ public class EnumArrays { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getArrayEnum() { return arrayEnum; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java index 4cc4cfa91066..3a834d1de4eb 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java @@ -14,14 +14,18 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.google.gson.annotations.SerializedName; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.io.IOException; +import com.google.gson.TypeAdapter; +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"), @@ -36,7 +40,6 @@ public enum EnumClass { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -46,7 +49,6 @@ public enum EnumClass { return String.valueOf(value); } - @JsonCreator public static EnumClass fromValue(String value) { for (EnumClass b : EnumClass.values()) { if (b.value.equals(value)) { @@ -55,5 +57,18 @@ public enum EnumClass { } 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); + } + } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java index 86855d1b366f..88934b2acd18 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java @@ -14,30 +14,25 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.openapitools.client.model.OuterEnum; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * EnumTest */ -@JsonPropertyOrder({ - EnumTest.JSON_PROPERTY_ENUM_STRING, - EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, - EnumTest.JSON_PROPERTY_ENUM_INTEGER, - EnumTest.JSON_PROPERTY_ENUM_NUMBER, - EnumTest.JSON_PROPERTY_OUTER_ENUM -}) public class EnumTest { /** * Gets or Sets enumString */ + @JsonAdapter(EnumStringEnum.Adapter.class) public enum EnumStringEnum { UPPER("UPPER"), @@ -51,7 +46,6 @@ public class EnumTest { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -61,7 +55,6 @@ public class EnumTest { return String.valueOf(value); } - @JsonCreator public static EnumStringEnum fromValue(String value) { for (EnumStringEnum b : EnumStringEnum.values()) { if (b.value.equals(value)) { @@ -70,14 +63,29 @@ public class EnumTest { } 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 final String JSON_PROPERTY_ENUM_STRING = "enum_string"; + public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; + @SerializedName(SERIALIZED_NAME_ENUM_STRING) private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) public enum EnumStringRequiredEnum { UPPER("UPPER"), @@ -91,7 +99,6 @@ public class EnumTest { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -101,7 +108,6 @@ public class EnumTest { return String.valueOf(value); } - @JsonCreator public static EnumStringRequiredEnum fromValue(String value) { for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { if (b.value.equals(value)) { @@ -110,14 +116,29 @@ public class EnumTest { } 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 final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; + public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; + @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger */ + @JsonAdapter(EnumIntegerEnum.Adapter.class) public enum EnumIntegerEnum { NUMBER_1(1), @@ -129,7 +150,6 @@ public class EnumTest { this.value = value; } - @JsonValue public Integer getValue() { return value; } @@ -139,7 +159,6 @@ public class EnumTest { return String.valueOf(value); } - @JsonCreator public static EnumIntegerEnum fromValue(Integer value) { for (EnumIntegerEnum b : EnumIntegerEnum.values()) { if (b.value.equals(value)) { @@ -148,14 +167,29 @@ public class EnumTest { } 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 final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; + public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; + @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber */ + @JsonAdapter(EnumNumberEnum.Adapter.class) public enum EnumNumberEnum { NUMBER_1_DOT_1(1.1), @@ -167,7 +201,6 @@ public class EnumTest { this.value = value; } - @JsonValue public Double getValue() { return value; } @@ -177,7 +210,6 @@ public class EnumTest { return String.valueOf(value); } - @JsonCreator public static EnumNumberEnum fromValue(Double value) { for (EnumNumberEnum b : EnumNumberEnum.values()) { if (b.value.equals(value)) { @@ -186,12 +218,27 @@ public class EnumTest { } 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 final String JSON_PROPERTY_ENUM_NUMBER = "enum_number"; + public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; + @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) private EnumNumberEnum enumNumber; - public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; + @SerializedName(SERIALIZED_NAME_OUTER_ENUM) private OuterEnum outerEnum; @@ -207,8 +254,6 @@ public class EnumTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ENUM_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public EnumStringEnum getEnumString() { return enumString; @@ -231,8 +276,6 @@ public class EnumTest { * @return enumStringRequired **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; @@ -256,8 +299,6 @@ public class EnumTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public EnumIntegerEnum getEnumInteger() { return enumInteger; @@ -281,8 +322,6 @@ public class EnumTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public EnumNumberEnum getEnumNumber() { return enumNumber; @@ -306,8 +345,6 @@ public class EnumTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_OUTER_ENUM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OuterEnum getOuterEnum() { return outerEnum; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f3d7af41c1df..a9001762c207 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -14,29 +14,28 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * FileSchemaTestClass */ -@JsonPropertyOrder({ - FileSchemaTestClass.JSON_PROPERTY_FILE, - FileSchemaTestClass.JSON_PROPERTY_FILES -}) public class FileSchemaTestClass { - public static final String JSON_PROPERTY_FILE = "file"; + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) private java.io.File file; - public static final String JSON_PROPERTY_FILES = "files"; + public static final String SERIALIZED_NAME_FILES = "files"; + @SerializedName(SERIALIZED_NAME_FILES) private List files = null; @@ -52,8 +51,6 @@ public class FileSchemaTestClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_FILE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public java.io.File getFile() { return file; @@ -85,8 +82,6 @@ public class FileSchemaTestClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_FILES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFiles() { return files; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FormatTest.java index 4271a12ec47f..f2876e0b4f5f 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FormatTest.java @@ -14,80 +14,79 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.File; +import java.io.IOException; import java.math.BigDecimal; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * FormatTest */ -@JsonPropertyOrder({ - FormatTest.JSON_PROPERTY_INTEGER, - FormatTest.JSON_PROPERTY_INT32, - FormatTest.JSON_PROPERTY_INT64, - FormatTest.JSON_PROPERTY_NUMBER, - FormatTest.JSON_PROPERTY_FLOAT, - FormatTest.JSON_PROPERTY_DOUBLE, - FormatTest.JSON_PROPERTY_STRING, - FormatTest.JSON_PROPERTY_BYTE, - FormatTest.JSON_PROPERTY_BINARY, - FormatTest.JSON_PROPERTY_DATE, - FormatTest.JSON_PROPERTY_DATE_TIME, - FormatTest.JSON_PROPERTY_UUID, - FormatTest.JSON_PROPERTY_PASSWORD, - FormatTest.JSON_PROPERTY_BIG_DECIMAL -}) public class FormatTest { - public static final String JSON_PROPERTY_INTEGER = "integer"; + public static final String SERIALIZED_NAME_INTEGER = "integer"; + @SerializedName(SERIALIZED_NAME_INTEGER) private Integer integer; - public static final String JSON_PROPERTY_INT32 = "int32"; + public static final String SERIALIZED_NAME_INT32 = "int32"; + @SerializedName(SERIALIZED_NAME_INT32) private Integer int32; - public static final String JSON_PROPERTY_INT64 = "int64"; + public static final String SERIALIZED_NAME_INT64 = "int64"; + @SerializedName(SERIALIZED_NAME_INT64) private Long int64; - public static final String JSON_PROPERTY_NUMBER = "number"; + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) private BigDecimal number; - public static final String JSON_PROPERTY_FLOAT = "float"; + public static final String SERIALIZED_NAME_FLOAT = "float"; + @SerializedName(SERIALIZED_NAME_FLOAT) private Float _float; - public static final String JSON_PROPERTY_DOUBLE = "double"; + public static final String SERIALIZED_NAME_DOUBLE = "double"; + @SerializedName(SERIALIZED_NAME_DOUBLE) private Double _double; - public static final String JSON_PROPERTY_STRING = "string"; + public static final String SERIALIZED_NAME_STRING = "string"; + @SerializedName(SERIALIZED_NAME_STRING) private String string; - public static final String JSON_PROPERTY_BYTE = "byte"; + public static final String SERIALIZED_NAME_BYTE = "byte"; + @SerializedName(SERIALIZED_NAME_BYTE) private byte[] _byte; - public static final String JSON_PROPERTY_BINARY = "binary"; + public static final String SERIALIZED_NAME_BINARY = "binary"; + @SerializedName(SERIALIZED_NAME_BINARY) private File binary; - public static final String JSON_PROPERTY_DATE = "date"; + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) private LocalDate date; - public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @SerializedName(SERIALIZED_NAME_DATE_TIME) private OffsetDateTime dateTime; - public static final String JSON_PROPERTY_UUID = "uuid"; + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) private UUID uuid; - public static final String JSON_PROPERTY_PASSWORD = "password"; + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) private String password; - public static final String JSON_PROPERTY_BIG_DECIMAL = "BigDecimal"; + public static final String SERIALIZED_NAME_BIG_DECIMAL = "BigDecimal"; + @SerializedName(SERIALIZED_NAME_BIG_DECIMAL) private BigDecimal bigDecimal; @@ -105,8 +104,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getInteger() { return integer; @@ -132,8 +129,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_INT32) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getInt32() { return int32; @@ -157,8 +152,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_INT64) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getInt64() { return int64; @@ -183,8 +176,6 @@ public class FormatTest { * @return number **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_NUMBER) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public BigDecimal getNumber() { return number; @@ -210,8 +201,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_FLOAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Float getFloat() { return _float; @@ -237,8 +226,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DOUBLE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Double getDouble() { return _double; @@ -262,8 +249,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getString() { return string; @@ -286,8 +271,6 @@ public class FormatTest { * @return _byte **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_BYTE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public byte[] getByte() { return _byte; @@ -311,8 +294,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BINARY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public File getBinary() { return binary; @@ -335,8 +316,6 @@ public class FormatTest { * @return date **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_DATE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public LocalDate getDate() { return date; @@ -360,8 +339,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DATE_TIME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getDateTime() { return dateTime; @@ -385,8 +362,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") - @JsonProperty(JSON_PROPERTY_UUID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public UUID getUuid() { return uuid; @@ -409,8 +384,6 @@ public class FormatTest { * @return password **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_PASSWORD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getPassword() { return password; @@ -434,8 +407,6 @@ public class FormatTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BIG_DECIMAL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public BigDecimal getBigDecimal() { return bigDecimal; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 4ef535d0ced6..67f0b0671225 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -14,27 +14,26 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * HasOnlyReadOnly */ -@JsonPropertyOrder({ - HasOnlyReadOnly.JSON_PROPERTY_BAR, - HasOnlyReadOnly.JSON_PROPERTY_FOO -}) public class HasOnlyReadOnly { - public static final String JSON_PROPERTY_BAR = "bar"; + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) private String bar; - public static final String JSON_PROPERTY_FOO = "foo"; + public static final String SERIALIZED_NAME_FOO = "foo"; + @SerializedName(SERIALIZED_NAME_FOO) private String foo; @@ -44,8 +43,6 @@ public class HasOnlyReadOnly { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BAR) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getBar() { return bar; @@ -60,8 +57,6 @@ public class HasOnlyReadOnly { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_FOO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getFoo() { return foo; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java index f1189185b717..3000dff96632 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java @@ -14,34 +14,31 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.HashMap; import java.util.List; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * MapTest */ -@JsonPropertyOrder({ - MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, - MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, - MapTest.JSON_PROPERTY_DIRECT_MAP, - MapTest.JSON_PROPERTY_INDIRECT_MAP -}) public class MapTest { - public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING) private Map> mapMapOfString = null; /** * Gets or Sets inner */ + @JsonAdapter(InnerEnum.Adapter.class) public enum InnerEnum { UPPER("UPPER"), @@ -53,7 +50,6 @@ public class MapTest { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -63,7 +59,6 @@ public class MapTest { return String.valueOf(value); } - @JsonCreator public static InnerEnum fromValue(String value) { for (InnerEnum b : InnerEnum.values()) { if (b.value.equals(value)) { @@ -72,15 +67,31 @@ public class MapTest { } 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 final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string"; + public static final String SERIALIZED_NAME_MAP_OF_ENUM_STRING = "map_of_enum_string"; + @SerializedName(SERIALIZED_NAME_MAP_OF_ENUM_STRING) private Map mapOfEnumString = null; - public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + public static final String SERIALIZED_NAME_DIRECT_MAP = "direct_map"; + @SerializedName(SERIALIZED_NAME_DIRECT_MAP) private Map directMap = null; - public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; + @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) private Map indirectMap = null; @@ -104,8 +115,6 @@ public class MapTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getMapMapOfString() { return mapMapOfString; @@ -137,8 +146,6 @@ public class MapTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getMapOfEnumString() { return mapOfEnumString; @@ -170,8 +177,6 @@ public class MapTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DIRECT_MAP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getDirectMap() { return directMap; @@ -203,8 +208,6 @@ public class MapTest { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getIndirectMap() { return indirectMap; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 2847bfdf4e03..959d370bb733 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -14,37 +14,36 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import org.openapitools.client.model.Animal; import org.threeten.bp.OffsetDateTime; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * MixedPropertiesAndAdditionalPropertiesClass */ -@JsonPropertyOrder({ - MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, - MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, - MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP -}) public class MixedPropertiesAndAdditionalPropertiesClass { - public static final String JSON_PROPERTY_UUID = "uuid"; + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) private UUID uuid; - public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @SerializedName(SERIALIZED_NAME_DATE_TIME) private OffsetDateTime dateTime; - public static final String JSON_PROPERTY_MAP = "map"; + public static final String SERIALIZED_NAME_MAP = "map"; + @SerializedName(SERIALIZED_NAME_MAP) private Map map = null; @@ -60,8 +59,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_UUID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public UUID getUuid() { return uuid; @@ -85,8 +82,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DATE_TIME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getDateTime() { return dateTime; @@ -118,8 +113,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getMap() { return map; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Model200Response.java index 5c0582506217..69349f287aab 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Model200Response.java @@ -14,28 +14,27 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") -@JsonPropertyOrder({ - Model200Response.JSON_PROPERTY_NAME, - Model200Response.JSON_PROPERTY_PROPERTY_CLASS -}) public class Model200Response { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private Integer name; - public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; + @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) private String propertyClass; @@ -51,8 +50,6 @@ public class Model200Response { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getName() { return name; @@ -76,8 +73,6 @@ public class Model200Response { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPropertyClass() { return propertyClass; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 65792b1c28d5..647d875a5ad2 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -14,31 +14,30 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * ModelApiResponse */ -@JsonPropertyOrder({ - ModelApiResponse.JSON_PROPERTY_CODE, - ModelApiResponse.JSON_PROPERTY_TYPE, - ModelApiResponse.JSON_PROPERTY_MESSAGE -}) public class ModelApiResponse { - public static final String JSON_PROPERTY_CODE = "code"; + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) private Integer code; - public static final String JSON_PROPERTY_TYPE = "type"; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) private String type; - public static final String JSON_PROPERTY_MESSAGE = "message"; + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) private String message; @@ -54,8 +53,6 @@ public class ModelApiResponse { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getCode() { return code; @@ -79,8 +76,6 @@ public class ModelApiResponse { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getType() { return type; @@ -104,8 +99,6 @@ public class ModelApiResponse { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getMessage() { return message; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelReturn.java index 7f1c7276402c..3f6556b5415a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -14,24 +14,23 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -@JsonPropertyOrder({ - ModelReturn.JSON_PROPERTY_RETURN -}) public class ModelReturn { - public static final String JSON_PROPERTY_RETURN = "return"; + public static final String SERIALIZED_NAME_RETURN = "return"; + @SerializedName(SERIALIZED_NAME_RETURN) private Integer _return; @@ -47,8 +46,6 @@ public class ModelReturn { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_RETURN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getReturn() { return _return; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Name.java index dc57304848a0..aa9bd629b33f 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Name.java @@ -14,36 +14,35 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") -@JsonPropertyOrder({ - Name.JSON_PROPERTY_NAME, - Name.JSON_PROPERTY_SNAKE_CASE, - Name.JSON_PROPERTY_PROPERTY, - Name.JSON_PROPERTY_123NUMBER -}) public class Name { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private Integer name; - public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; + @SerializedName(SERIALIZED_NAME_SNAKE_CASE) private Integer snakeCase; - public static final String JSON_PROPERTY_PROPERTY = "property"; + public static final String SERIALIZED_NAME_PROPERTY = "property"; + @SerializedName(SERIALIZED_NAME_PROPERTY) private String property; - public static final String JSON_PROPERTY_123NUMBER = "123Number"; + public static final String SERIALIZED_NAME_123NUMBER = "123Number"; + @SerializedName(SERIALIZED_NAME_123NUMBER) private Integer _123number; @@ -58,8 +57,6 @@ public class Name { * @return name **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getName() { return name; @@ -77,8 +74,6 @@ public class Name { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_SNAKE_CASE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getSnakeCase() { return snakeCase; @@ -99,8 +94,6 @@ public class Name { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PROPERTY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getProperty() { return property; @@ -118,8 +111,6 @@ public class Name { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_123NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer get123number() { return _123number; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/NumberOnly.java index 84f061a152bc..04ec2b312e40 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -14,24 +14,23 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * NumberOnly */ -@JsonPropertyOrder({ - NumberOnly.JSON_PROPERTY_JUST_NUMBER -}) public class NumberOnly { - public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; + @SerializedName(SERIALIZED_NAME_JUST_NUMBER) private BigDecimal justNumber; @@ -47,8 +46,6 @@ public class NumberOnly { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_JUST_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public BigDecimal getJustNumber() { return justNumber; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java index 650d83943cab..dbb68f49ff5c 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java @@ -14,43 +14,41 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.threeten.bp.OffsetDateTime; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * Order */ -@JsonPropertyOrder({ - Order.JSON_PROPERTY_ID, - Order.JSON_PROPERTY_PET_ID, - Order.JSON_PROPERTY_QUANTITY, - Order.JSON_PROPERTY_SHIP_DATE, - Order.JSON_PROPERTY_STATUS, - Order.JSON_PROPERTY_COMPLETE -}) public class Order { - public static final String JSON_PROPERTY_ID = "id"; + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) private Long id; - public static final String JSON_PROPERTY_PET_ID = "petId"; + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) private Long petId; - public static final String JSON_PROPERTY_QUANTITY = "quantity"; + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) private Integer quantity; - public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) private OffsetDateTime shipDate; /** * Order Status */ + @JsonAdapter(StatusEnum.Adapter.class) public enum StatusEnum { PLACED("placed"), @@ -64,7 +62,6 @@ public class Order { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -74,7 +71,6 @@ public class Order { return String.valueOf(value); } - @JsonCreator public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { if (b.value.equals(value)) { @@ -83,12 +79,27 @@ public class Order { } 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 final String JSON_PROPERTY_STATUS = "status"; + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) private StatusEnum status; - public static final String JSON_PROPERTY_COMPLETE = "complete"; + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) private Boolean complete = false; @@ -104,8 +115,6 @@ public class Order { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getId() { return id; @@ -129,8 +138,6 @@ public class Order { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PET_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getPetId() { return petId; @@ -154,8 +161,6 @@ public class Order { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_QUANTITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getQuantity() { return quantity; @@ -179,8 +184,6 @@ public class Order { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_SHIP_DATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getShipDate() { return shipDate; @@ -204,8 +207,6 @@ public class Order { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public StatusEnum getStatus() { return status; @@ -229,8 +230,6 @@ public class Order { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_COMPLETE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isComplete() { return complete; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterComposite.java index c419a4fee2c4..e92bafd7919f 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -14,32 +14,31 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * OuterComposite */ -@JsonPropertyOrder({ - OuterComposite.JSON_PROPERTY_MY_NUMBER, - OuterComposite.JSON_PROPERTY_MY_STRING, - OuterComposite.JSON_PROPERTY_MY_BOOLEAN -}) public class OuterComposite { - public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; + @SerializedName(SERIALIZED_NAME_MY_NUMBER) private BigDecimal myNumber; - public static final String JSON_PROPERTY_MY_STRING = "my_string"; + public static final String SERIALIZED_NAME_MY_STRING = "my_string"; + @SerializedName(SERIALIZED_NAME_MY_STRING) private String myString; - public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; + @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) private Boolean myBoolean; @@ -55,8 +54,6 @@ public class OuterComposite { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public BigDecimal getMyNumber() { return myNumber; @@ -80,8 +77,6 @@ public class OuterComposite { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MY_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getMyString() { return myString; @@ -105,8 +100,6 @@ public class OuterComposite { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isMyBoolean() { return myBoolean; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java index 6618d1f9c5f5..9d87de3f12d7 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -14,14 +14,18 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.google.gson.annotations.SerializedName; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.io.IOException; +import com.google.gson.TypeAdapter; +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"), @@ -36,7 +40,6 @@ public enum OuterEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -46,7 +49,6 @@ public enum OuterEnum { return String.valueOf(value); } - @JsonCreator public static OuterEnum fromValue(String value) { for (OuterEnum b : OuterEnum.values()) { if (b.value.equals(value)) { @@ -55,5 +57,18 @@ public enum OuterEnum { } 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); + } + } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java index ab2be8bc687e..5b9c995a83ed 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java @@ -14,49 +14,48 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.List; import org.openapitools.client.model.Category; import org.openapitools.client.model.Tag; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * Pet */ -@JsonPropertyOrder({ - Pet.JSON_PROPERTY_ID, - Pet.JSON_PROPERTY_CATEGORY, - Pet.JSON_PROPERTY_NAME, - Pet.JSON_PROPERTY_PHOTO_URLS, - Pet.JSON_PROPERTY_TAGS, - Pet.JSON_PROPERTY_STATUS -}) public class Pet { - public static final String JSON_PROPERTY_ID = "id"; + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) private Long id; - public static final String JSON_PROPERTY_CATEGORY = "category"; + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) private Category category; - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; - public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) private List photoUrls = new ArrayList(); - public static final String JSON_PROPERTY_TAGS = "tags"; + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) private List tags = null; /** * pet status in the store */ + @JsonAdapter(StatusEnum.Adapter.class) public enum StatusEnum { AVAILABLE("available"), @@ -70,7 +69,6 @@ public class Pet { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -80,7 +78,6 @@ public class Pet { return String.valueOf(value); } - @JsonCreator public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { if (b.value.equals(value)) { @@ -89,9 +86,23 @@ public class Pet { } 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 final String JSON_PROPERTY_STATUS = "status"; + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) private StatusEnum status; @@ -107,8 +118,6 @@ public class Pet { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getId() { return id; @@ -132,8 +141,6 @@ public class Pet { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_CATEGORY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Category getCategory() { return category; @@ -156,8 +163,6 @@ public class Pet { * @return name **/ @ApiModelProperty(example = "doggie", required = true, value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getName() { return name; @@ -185,8 +190,6 @@ public class Pet { * @return photoUrls **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_PHOTO_URLS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getPhotoUrls() { return photoUrls; @@ -218,8 +221,6 @@ public class Pet { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_TAGS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getTags() { return tags; @@ -243,8 +244,6 @@ public class Pet { **/ @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public StatusEnum getStatus() { return status; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index b6a7acbe57ef..5e3f9e1c4b2b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -14,27 +14,26 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * ReadOnlyFirst */ -@JsonPropertyOrder({ - ReadOnlyFirst.JSON_PROPERTY_BAR, - ReadOnlyFirst.JSON_PROPERTY_BAZ -}) public class ReadOnlyFirst { - public static final String JSON_PROPERTY_BAR = "bar"; + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) private String bar; - public static final String JSON_PROPERTY_BAZ = "baz"; + public static final String SERIALIZED_NAME_BAZ = "baz"; + @SerializedName(SERIALIZED_NAME_BAZ) private String baz; @@ -44,8 +43,6 @@ public class ReadOnlyFirst { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BAR) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getBar() { return bar; @@ -66,8 +63,6 @@ public class ReadOnlyFirst { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BAZ) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getBaz() { return baz; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/SpecialModelName.java index e1f4594db34e..2d2e137e4b03 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -14,23 +14,22 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * SpecialModelName */ -@JsonPropertyOrder({ - SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME -}) public class SpecialModelName { - public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) private Long $specialPropertyName; @@ -46,8 +45,6 @@ public class SpecialModelName { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long get$SpecialPropertyName() { return $specialPropertyName; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Tag.java index 0119bf5e1e5a..7b4f3f25e543 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Tag.java @@ -14,27 +14,26 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * Tag */ -@JsonPropertyOrder({ - Tag.JSON_PROPERTY_ID, - Tag.JSON_PROPERTY_NAME -}) public class Tag { - public static final String JSON_PROPERTY_ID = "id"; + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) private Long id; - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -50,8 +49,6 @@ public class Tag { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getId() { return id; @@ -75,8 +72,6 @@ public class Tag { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 8dc23d607977..5bf55d060d6b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -14,42 +14,41 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * TypeHolderDefault */ -@JsonPropertyOrder({ - TypeHolderDefault.JSON_PROPERTY_STRING_ITEM, - TypeHolderDefault.JSON_PROPERTY_NUMBER_ITEM, - TypeHolderDefault.JSON_PROPERTY_INTEGER_ITEM, - TypeHolderDefault.JSON_PROPERTY_BOOL_ITEM, - TypeHolderDefault.JSON_PROPERTY_ARRAY_ITEM -}) public class TypeHolderDefault { - public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; + public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; + @SerializedName(SERIALIZED_NAME_STRING_ITEM) private String stringItem = "what"; - public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; + public static final String SERIALIZED_NAME_NUMBER_ITEM = "number_item"; + @SerializedName(SERIALIZED_NAME_NUMBER_ITEM) private BigDecimal numberItem; - public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; + public static final String SERIALIZED_NAME_INTEGER_ITEM = "integer_item"; + @SerializedName(SERIALIZED_NAME_INTEGER_ITEM) private Integer integerItem; - public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; + public static final String SERIALIZED_NAME_BOOL_ITEM = "bool_item"; + @SerializedName(SERIALIZED_NAME_BOOL_ITEM) private Boolean boolItem = true; - public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; + public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; + @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) private List arrayItem = new ArrayList(); @@ -64,8 +63,6 @@ public class TypeHolderDefault { * @return stringItem **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_STRING_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getStringItem() { return stringItem; @@ -88,8 +85,6 @@ public class TypeHolderDefault { * @return numberItem **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public BigDecimal getNumberItem() { return numberItem; @@ -112,8 +107,6 @@ public class TypeHolderDefault { * @return integerItem **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getIntegerItem() { return integerItem; @@ -136,8 +129,6 @@ public class TypeHolderDefault { * @return boolItem **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_BOOL_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean isBoolItem() { return boolItem; @@ -165,8 +156,6 @@ public class TypeHolderDefault { * @return arrayItem **/ @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getArrayItem() { return arrayItem; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 99e070c47edf..37aa0d908e3e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -14,46 +14,45 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * TypeHolderExample */ -@JsonPropertyOrder({ - TypeHolderExample.JSON_PROPERTY_STRING_ITEM, - TypeHolderExample.JSON_PROPERTY_NUMBER_ITEM, - TypeHolderExample.JSON_PROPERTY_FLOAT_ITEM, - TypeHolderExample.JSON_PROPERTY_INTEGER_ITEM, - TypeHolderExample.JSON_PROPERTY_BOOL_ITEM, - TypeHolderExample.JSON_PROPERTY_ARRAY_ITEM -}) public class TypeHolderExample { - public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; + public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; + @SerializedName(SERIALIZED_NAME_STRING_ITEM) private String stringItem; - public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; + public static final String SERIALIZED_NAME_NUMBER_ITEM = "number_item"; + @SerializedName(SERIALIZED_NAME_NUMBER_ITEM) private BigDecimal numberItem; - public static final String JSON_PROPERTY_FLOAT_ITEM = "float_item"; + public static final String SERIALIZED_NAME_FLOAT_ITEM = "float_item"; + @SerializedName(SERIALIZED_NAME_FLOAT_ITEM) private Float floatItem; - public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; + public static final String SERIALIZED_NAME_INTEGER_ITEM = "integer_item"; + @SerializedName(SERIALIZED_NAME_INTEGER_ITEM) private Integer integerItem; - public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; + public static final String SERIALIZED_NAME_BOOL_ITEM = "bool_item"; + @SerializedName(SERIALIZED_NAME_BOOL_ITEM) private Boolean boolItem; - public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; + public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; + @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) private List arrayItem = new ArrayList(); @@ -68,8 +67,6 @@ public class TypeHolderExample { * @return stringItem **/ @ApiModelProperty(example = "what", required = true, value = "") - @JsonProperty(JSON_PROPERTY_STRING_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getStringItem() { return stringItem; @@ -92,8 +89,6 @@ public class TypeHolderExample { * @return numberItem **/ @ApiModelProperty(example = "1.234", required = true, value = "") - @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public BigDecimal getNumberItem() { return numberItem; @@ -116,8 +111,6 @@ public class TypeHolderExample { * @return floatItem **/ @ApiModelProperty(example = "1.234", required = true, value = "") - @JsonProperty(JSON_PROPERTY_FLOAT_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Float getFloatItem() { return floatItem; @@ -140,8 +133,6 @@ public class TypeHolderExample { * @return integerItem **/ @ApiModelProperty(example = "-2", required = true, value = "") - @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getIntegerItem() { return integerItem; @@ -164,8 +155,6 @@ public class TypeHolderExample { * @return boolItem **/ @ApiModelProperty(example = "true", required = true, value = "") - @JsonProperty(JSON_PROPERTY_BOOL_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean isBoolItem() { return boolItem; @@ -193,8 +182,6 @@ public class TypeHolderExample { * @return arrayItem **/ @ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getArrayItem() { return arrayItem; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/User.java index 6524d25cb788..20b6c8f55b05 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/User.java @@ -14,51 +14,50 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.IOException; /** * User */ -@JsonPropertyOrder({ - User.JSON_PROPERTY_ID, - User.JSON_PROPERTY_USERNAME, - User.JSON_PROPERTY_FIRST_NAME, - User.JSON_PROPERTY_LAST_NAME, - User.JSON_PROPERTY_EMAIL, - User.JSON_PROPERTY_PASSWORD, - User.JSON_PROPERTY_PHONE, - User.JSON_PROPERTY_USER_STATUS -}) public class User { - public static final String JSON_PROPERTY_ID = "id"; + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) private Long id; - public static final String JSON_PROPERTY_USERNAME = "username"; + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) private String username; - public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) private String firstName; - public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) private String lastName; - public static final String JSON_PROPERTY_EMAIL = "email"; + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) private String email; - public static final String JSON_PROPERTY_PASSWORD = "password"; + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) private String password; - public static final String JSON_PROPERTY_PHONE = "phone"; + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) private String phone; - public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) private Integer userStatus; @@ -74,8 +73,6 @@ public class User { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getId() { return id; @@ -99,8 +96,6 @@ public class User { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_USERNAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getUsername() { return username; @@ -124,8 +119,6 @@ public class User { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_FIRST_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getFirstName() { return firstName; @@ -149,8 +142,6 @@ public class User { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_LAST_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getLastName() { return lastName; @@ -174,8 +165,6 @@ public class User { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_EMAIL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getEmail() { return email; @@ -199,8 +188,6 @@ public class User { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PASSWORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPassword() { return password; @@ -224,8 +211,6 @@ public class User { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PHONE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPhone() { return phone; @@ -249,8 +234,6 @@ public class User { **/ @javax.annotation.Nullable @ApiModelProperty(value = "User Status") - @JsonProperty(JSON_PROPERTY_USER_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getUserStatus() { return userStatus; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/XmlItem.java index 6268bb6245fb..e9a91452b921 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/XmlItem.java @@ -14,138 +14,137 @@ package org.openapitools.client.model; import org.apache.commons.lang3.ObjectUtils; -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.google.gson.TypeAdapter; +import 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.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * XmlItem */ -@JsonPropertyOrder({ - XmlItem.JSON_PROPERTY_ATTRIBUTE_STRING, - XmlItem.JSON_PROPERTY_ATTRIBUTE_NUMBER, - XmlItem.JSON_PROPERTY_ATTRIBUTE_INTEGER, - XmlItem.JSON_PROPERTY_ATTRIBUTE_BOOLEAN, - XmlItem.JSON_PROPERTY_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_NAME_STRING, - XmlItem.JSON_PROPERTY_NAME_NUMBER, - XmlItem.JSON_PROPERTY_NAME_INTEGER, - XmlItem.JSON_PROPERTY_NAME_BOOLEAN, - XmlItem.JSON_PROPERTY_NAME_ARRAY, - XmlItem.JSON_PROPERTY_NAME_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_STRING, - XmlItem.JSON_PROPERTY_PREFIX_NUMBER, - XmlItem.JSON_PROPERTY_PREFIX_INTEGER, - XmlItem.JSON_PROPERTY_PREFIX_BOOLEAN, - XmlItem.JSON_PROPERTY_PREFIX_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_NAMESPACE_STRING, - XmlItem.JSON_PROPERTY_NAMESPACE_NUMBER, - XmlItem.JSON_PROPERTY_NAMESPACE_INTEGER, - XmlItem.JSON_PROPERTY_NAMESPACE_BOOLEAN, - XmlItem.JSON_PROPERTY_NAMESPACE_ARRAY, - XmlItem.JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_NS_STRING, - XmlItem.JSON_PROPERTY_PREFIX_NS_NUMBER, - XmlItem.JSON_PROPERTY_PREFIX_NS_INTEGER, - XmlItem.JSON_PROPERTY_PREFIX_NS_BOOLEAN, - XmlItem.JSON_PROPERTY_PREFIX_NS_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY -}) public class XmlItem { - public static final String JSON_PROPERTY_ATTRIBUTE_STRING = "attribute_string"; + public static final String SERIALIZED_NAME_ATTRIBUTE_STRING = "attribute_string"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_STRING) private String attributeString; - public static final String JSON_PROPERTY_ATTRIBUTE_NUMBER = "attribute_number"; + public static final String SERIALIZED_NAME_ATTRIBUTE_NUMBER = "attribute_number"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_NUMBER) private BigDecimal attributeNumber; - public static final String JSON_PROPERTY_ATTRIBUTE_INTEGER = "attribute_integer"; + public static final String SERIALIZED_NAME_ATTRIBUTE_INTEGER = "attribute_integer"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_INTEGER) private Integer attributeInteger; - public static final String JSON_PROPERTY_ATTRIBUTE_BOOLEAN = "attribute_boolean"; + public static final String SERIALIZED_NAME_ATTRIBUTE_BOOLEAN = "attribute_boolean"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_BOOLEAN) private Boolean attributeBoolean; - public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array"; + public static final String SERIALIZED_NAME_WRAPPED_ARRAY = "wrapped_array"; + @SerializedName(SERIALIZED_NAME_WRAPPED_ARRAY) private List wrappedArray = null; - public static final String JSON_PROPERTY_NAME_STRING = "name_string"; + public static final String SERIALIZED_NAME_NAME_STRING = "name_string"; + @SerializedName(SERIALIZED_NAME_NAME_STRING) private String nameString; - public static final String JSON_PROPERTY_NAME_NUMBER = "name_number"; + public static final String SERIALIZED_NAME_NAME_NUMBER = "name_number"; + @SerializedName(SERIALIZED_NAME_NAME_NUMBER) private BigDecimal nameNumber; - public static final String JSON_PROPERTY_NAME_INTEGER = "name_integer"; + public static final String SERIALIZED_NAME_NAME_INTEGER = "name_integer"; + @SerializedName(SERIALIZED_NAME_NAME_INTEGER) private Integer nameInteger; - public static final String JSON_PROPERTY_NAME_BOOLEAN = "name_boolean"; + public static final String SERIALIZED_NAME_NAME_BOOLEAN = "name_boolean"; + @SerializedName(SERIALIZED_NAME_NAME_BOOLEAN) private Boolean nameBoolean; - public static final String JSON_PROPERTY_NAME_ARRAY = "name_array"; + public static final String SERIALIZED_NAME_NAME_ARRAY = "name_array"; + @SerializedName(SERIALIZED_NAME_NAME_ARRAY) private List nameArray = null; - public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array"; + public static final String SERIALIZED_NAME_NAME_WRAPPED_ARRAY = "name_wrapped_array"; + @SerializedName(SERIALIZED_NAME_NAME_WRAPPED_ARRAY) private List nameWrappedArray = null; - public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string"; + public static final String SERIALIZED_NAME_PREFIX_STRING = "prefix_string"; + @SerializedName(SERIALIZED_NAME_PREFIX_STRING) private String prefixString; - public static final String JSON_PROPERTY_PREFIX_NUMBER = "prefix_number"; + public static final String SERIALIZED_NAME_PREFIX_NUMBER = "prefix_number"; + @SerializedName(SERIALIZED_NAME_PREFIX_NUMBER) private BigDecimal prefixNumber; - public static final String JSON_PROPERTY_PREFIX_INTEGER = "prefix_integer"; + public static final String SERIALIZED_NAME_PREFIX_INTEGER = "prefix_integer"; + @SerializedName(SERIALIZED_NAME_PREFIX_INTEGER) private Integer prefixInteger; - public static final String JSON_PROPERTY_PREFIX_BOOLEAN = "prefix_boolean"; + public static final String SERIALIZED_NAME_PREFIX_BOOLEAN = "prefix_boolean"; + @SerializedName(SERIALIZED_NAME_PREFIX_BOOLEAN) private Boolean prefixBoolean; - public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array"; + public static final String SERIALIZED_NAME_PREFIX_ARRAY = "prefix_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_ARRAY) private List prefixArray = null; - public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; + public static final String SERIALIZED_NAME_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_WRAPPED_ARRAY) private List prefixWrappedArray = null; - public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string"; + public static final String SERIALIZED_NAME_NAMESPACE_STRING = "namespace_string"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_STRING) private String namespaceString; - public static final String JSON_PROPERTY_NAMESPACE_NUMBER = "namespace_number"; + public static final String SERIALIZED_NAME_NAMESPACE_NUMBER = "namespace_number"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_NUMBER) private BigDecimal namespaceNumber; - public static final String JSON_PROPERTY_NAMESPACE_INTEGER = "namespace_integer"; + public static final String SERIALIZED_NAME_NAMESPACE_INTEGER = "namespace_integer"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_INTEGER) private Integer namespaceInteger; - public static final String JSON_PROPERTY_NAMESPACE_BOOLEAN = "namespace_boolean"; + public static final String SERIALIZED_NAME_NAMESPACE_BOOLEAN = "namespace_boolean"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_BOOLEAN) private Boolean namespaceBoolean; - public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array"; + public static final String SERIALIZED_NAME_NAMESPACE_ARRAY = "namespace_array"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_ARRAY) private List namespaceArray = null; - public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; + public static final String SERIALIZED_NAME_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_WRAPPED_ARRAY) private List namespaceWrappedArray = null; - public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string"; + public static final String SERIALIZED_NAME_PREFIX_NS_STRING = "prefix_ns_string"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_STRING) private String prefixNsString; - public static final String JSON_PROPERTY_PREFIX_NS_NUMBER = "prefix_ns_number"; + public static final String SERIALIZED_NAME_PREFIX_NS_NUMBER = "prefix_ns_number"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_NUMBER) private BigDecimal prefixNsNumber; - public static final String JSON_PROPERTY_PREFIX_NS_INTEGER = "prefix_ns_integer"; + public static final String SERIALIZED_NAME_PREFIX_NS_INTEGER = "prefix_ns_integer"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_INTEGER) private Integer prefixNsInteger; - public static final String JSON_PROPERTY_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; + public static final String SERIALIZED_NAME_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_BOOLEAN) private Boolean prefixNsBoolean; - public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array"; + public static final String SERIALIZED_NAME_PREFIX_NS_ARRAY = "prefix_ns_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_ARRAY) private List prefixNsArray = null; - public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; + public static final String SERIALIZED_NAME_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_WRAPPED_ARRAY) private List prefixNsWrappedArray = null; @@ -161,8 +160,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAttributeString() { return attributeString; @@ -186,8 +183,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public BigDecimal getAttributeNumber() { return attributeNumber; @@ -211,8 +206,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAttributeInteger() { return attributeInteger; @@ -236,8 +229,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isAttributeBoolean() { return attributeBoolean; @@ -269,8 +260,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getWrappedArray() { return wrappedArray; @@ -294,8 +283,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_NAME_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getNameString() { return nameString; @@ -319,8 +306,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_NAME_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public BigDecimal getNameNumber() { return nameNumber; @@ -344,8 +329,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_NAME_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNameInteger() { return nameInteger; @@ -369,8 +352,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_NAME_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isNameBoolean() { return nameBoolean; @@ -402,8 +383,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNameArray() { return nameArray; @@ -435,8 +414,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNameWrappedArray() { return nameWrappedArray; @@ -460,8 +437,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPrefixString() { return prefixString; @@ -485,8 +460,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public BigDecimal getPrefixNumber() { return prefixNumber; @@ -510,8 +483,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPrefixInteger() { return prefixInteger; @@ -535,8 +506,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isPrefixBoolean() { return prefixBoolean; @@ -568,8 +537,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getPrefixArray() { return prefixArray; @@ -601,8 +568,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getPrefixWrappedArray() { return prefixWrappedArray; @@ -626,8 +591,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getNamespaceString() { return namespaceString; @@ -651,8 +614,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public BigDecimal getNamespaceNumber() { return namespaceNumber; @@ -676,8 +637,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNamespaceInteger() { return namespaceInteger; @@ -701,8 +660,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isNamespaceBoolean() { return namespaceBoolean; @@ -734,8 +691,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNamespaceArray() { return namespaceArray; @@ -767,8 +722,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNamespaceWrappedArray() { return namespaceWrappedArray; @@ -792,8 +745,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPrefixNsString() { return prefixNsString; @@ -817,8 +768,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public BigDecimal getPrefixNsNumber() { return prefixNsNumber; @@ -842,8 +791,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPrefixNsInteger() { return prefixNsInteger; @@ -867,8 +814,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean isPrefixNsBoolean() { return prefixNsBoolean; @@ -900,8 +845,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getPrefixNsArray() { return prefixNsArray; @@ -933,8 +876,6 @@ public class XmlItem { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getPrefixNsWrappedArray() { return prefixNsWrappedArray; diff --git a/samples/client/petstore/java/jersey2/.gitignore b/samples/client/petstore/java/jersey2-java7/.gitignore similarity index 100% rename from samples/client/petstore/java/jersey2/.gitignore rename to samples/client/petstore/java/jersey2-java7/.gitignore diff --git a/samples/client/petstore/java/jersey2/.openapi-generator-ignore b/samples/client/petstore/java/jersey2-java7/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/java/jersey2/.openapi-generator-ignore rename to samples/client/petstore/java/jersey2-java7/.openapi-generator-ignore diff --git a/samples/client/petstore/java/jersey2/.openapi-generator/VERSION b/samples/client/petstore/java/jersey2-java7/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/java/jersey2/.openapi-generator/VERSION rename to samples/client/petstore/java/jersey2-java7/.openapi-generator/VERSION diff --git a/samples/client/petstore/java/jersey2/.travis.yml b/samples/client/petstore/java/jersey2-java7/.travis.yml similarity index 100% rename from samples/client/petstore/java/jersey2/.travis.yml rename to samples/client/petstore/java/jersey2-java7/.travis.yml diff --git a/samples/client/petstore/java/jersey2/README.md b/samples/client/petstore/java/jersey2-java7/README.md similarity index 98% rename from samples/client/petstore/java/jersey2/README.md rename to samples/client/petstore/java/jersey2-java7/README.md index a42ed132fe24..0e600ab1410c 100644 --- a/samples/client/petstore/java/jersey2/README.md +++ b/samples/client/petstore/java/jersey2-java7/README.md @@ -1,4 +1,4 @@ -# petstore-jersey2 +# petstore-jersey2-java7 OpenAPI Petstore @@ -39,7 +39,7 @@ Add this dependency to your project's POM: ```xml org.openapitools - petstore-jersey2 + petstore-jersey2-java7 1.0.0 compile @@ -50,7 +50,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-jersey2:1.0.0" +compile "org.openapitools:petstore-jersey2-java7:1.0.0" ``` ### Others @@ -63,7 +63,7 @@ mvn clean package Then manually install the following JARs: -- `target/petstore-jersey2-1.0.0.jar` +- `target/petstore-jersey2-java7-1.0.0.jar` - `target/lib/*.jar` ## Getting Started diff --git a/samples/client/petstore/java/jersey2/api/openapi.yaml b/samples/client/petstore/java/jersey2-java7/api/openapi.yaml similarity index 100% rename from samples/client/petstore/java/jersey2/api/openapi.yaml rename to samples/client/petstore/java/jersey2-java7/api/openapi.yaml diff --git a/samples/client/petstore/java/jersey2/build.gradle b/samples/client/petstore/java/jersey2-java7/build.gradle similarity index 98% rename from samples/client/petstore/java/jersey2/build.gradle rename to samples/client/petstore/java/jersey2-java7/build.gradle index 8e167a0d73fe..6e320c348104 100644 --- a/samples/client/petstore/java/jersey2/build.gradle +++ b/samples/client/petstore/java/jersey2-java7/build.gradle @@ -83,7 +83,7 @@ if(hasProperty('target') && target == 'android') { install { repositories.mavenInstaller { - pom.artifactId = 'petstore-jersey2' + pom.artifactId = 'petstore-jersey2-java7' } } diff --git a/samples/client/petstore/java/jersey2/build.sbt b/samples/client/petstore/java/jersey2-java7/build.sbt similarity index 96% rename from samples/client/petstore/java/jersey2/build.sbt rename to samples/client/petstore/java/jersey2-java7/build.sbt index 5c91d04b8e80..bf35ad4f5207 100644 --- a/samples/client/petstore/java/jersey2/build.sbt +++ b/samples/client/petstore/java/jersey2-java7/build.sbt @@ -1,7 +1,7 @@ lazy val root = (project in file(".")). settings( organization := "org.openapitools", - name := "petstore-jersey2", + name := "petstore-jersey2-java7", version := "1.0.0", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), diff --git a/samples/client/petstore/java/jersey2/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesAnyType.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AdditionalPropertiesAnyType.md rename to samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesAnyType.md diff --git a/samples/client/petstore/java/jersey2/docs/AdditionalPropertiesArray.md b/samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesArray.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AdditionalPropertiesArray.md rename to samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesArray.md diff --git a/samples/client/petstore/java/jersey2/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesBoolean.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AdditionalPropertiesBoolean.md rename to samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesBoolean.md diff --git a/samples/client/petstore/java/jersey2/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesClass.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AdditionalPropertiesClass.md rename to samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesClass.md diff --git a/samples/client/petstore/java/jersey2/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesInteger.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AdditionalPropertiesInteger.md rename to samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesInteger.md diff --git a/samples/client/petstore/java/jersey2/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesNumber.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AdditionalPropertiesNumber.md rename to samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesNumber.md diff --git a/samples/client/petstore/java/jersey2/docs/AdditionalPropertiesObject.md b/samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesObject.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AdditionalPropertiesObject.md rename to samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesObject.md diff --git a/samples/client/petstore/java/jersey2/docs/AdditionalPropertiesString.md b/samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesString.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AdditionalPropertiesString.md rename to samples/client/petstore/java/jersey2-java7/docs/AdditionalPropertiesString.md diff --git a/samples/client/petstore/java/jersey2/docs/Animal.md b/samples/client/petstore/java/jersey2-java7/docs/Animal.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Animal.md rename to samples/client/petstore/java/jersey2-java7/docs/Animal.md diff --git a/samples/client/petstore/java/jersey2/docs/AnimalFarm.md b/samples/client/petstore/java/jersey2-java7/docs/AnimalFarm.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AnimalFarm.md rename to samples/client/petstore/java/jersey2-java7/docs/AnimalFarm.md diff --git a/samples/client/petstore/java/jersey2/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey2-java7/docs/AnotherFakeApi.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/AnotherFakeApi.md rename to samples/client/petstore/java/jersey2-java7/docs/AnotherFakeApi.md diff --git a/samples/client/petstore/java/jersey2/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/jersey2-java7/docs/ArrayOfArrayOfNumberOnly.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/ArrayOfArrayOfNumberOnly.md rename to samples/client/petstore/java/jersey2-java7/docs/ArrayOfArrayOfNumberOnly.md diff --git a/samples/client/petstore/java/jersey2/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/jersey2-java7/docs/ArrayOfNumberOnly.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/ArrayOfNumberOnly.md rename to samples/client/petstore/java/jersey2-java7/docs/ArrayOfNumberOnly.md diff --git a/samples/client/petstore/java/jersey2/docs/ArrayTest.md b/samples/client/petstore/java/jersey2-java7/docs/ArrayTest.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/ArrayTest.md rename to samples/client/petstore/java/jersey2-java7/docs/ArrayTest.md diff --git a/samples/client/petstore/java/jersey2/docs/BigCat.md b/samples/client/petstore/java/jersey2-java7/docs/BigCat.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/BigCat.md rename to samples/client/petstore/java/jersey2-java7/docs/BigCat.md diff --git a/samples/client/petstore/java/jersey2/docs/BigCatAllOf.md b/samples/client/petstore/java/jersey2-java7/docs/BigCatAllOf.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/BigCatAllOf.md rename to samples/client/petstore/java/jersey2-java7/docs/BigCatAllOf.md diff --git a/samples/client/petstore/java/jersey2/docs/Capitalization.md b/samples/client/petstore/java/jersey2-java7/docs/Capitalization.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Capitalization.md rename to samples/client/petstore/java/jersey2-java7/docs/Capitalization.md diff --git a/samples/client/petstore/java/jersey2/docs/Cat.md b/samples/client/petstore/java/jersey2-java7/docs/Cat.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Cat.md rename to samples/client/petstore/java/jersey2-java7/docs/Cat.md diff --git a/samples/client/petstore/java/jersey2/docs/CatAllOf.md b/samples/client/petstore/java/jersey2-java7/docs/CatAllOf.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/CatAllOf.md rename to samples/client/petstore/java/jersey2-java7/docs/CatAllOf.md diff --git a/samples/client/petstore/java/jersey2/docs/Category.md b/samples/client/petstore/java/jersey2-java7/docs/Category.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Category.md rename to samples/client/petstore/java/jersey2-java7/docs/Category.md diff --git a/samples/client/petstore/java/jersey2/docs/ClassModel.md b/samples/client/petstore/java/jersey2-java7/docs/ClassModel.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/ClassModel.md rename to samples/client/petstore/java/jersey2-java7/docs/ClassModel.md diff --git a/samples/client/petstore/java/jersey2/docs/Client.md b/samples/client/petstore/java/jersey2-java7/docs/Client.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Client.md rename to samples/client/petstore/java/jersey2-java7/docs/Client.md diff --git a/samples/client/petstore/java/jersey2/docs/Dog.md b/samples/client/petstore/java/jersey2-java7/docs/Dog.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Dog.md rename to samples/client/petstore/java/jersey2-java7/docs/Dog.md diff --git a/samples/client/petstore/java/jersey2/docs/DogAllOf.md b/samples/client/petstore/java/jersey2-java7/docs/DogAllOf.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/DogAllOf.md rename to samples/client/petstore/java/jersey2-java7/docs/DogAllOf.md diff --git a/samples/client/petstore/java/jersey2/docs/EnumArrays.md b/samples/client/petstore/java/jersey2-java7/docs/EnumArrays.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/EnumArrays.md rename to samples/client/petstore/java/jersey2-java7/docs/EnumArrays.md diff --git a/samples/client/petstore/java/jersey2/docs/EnumClass.md b/samples/client/petstore/java/jersey2-java7/docs/EnumClass.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/EnumClass.md rename to samples/client/petstore/java/jersey2-java7/docs/EnumClass.md diff --git a/samples/client/petstore/java/jersey2/docs/EnumTest.md b/samples/client/petstore/java/jersey2-java7/docs/EnumTest.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/EnumTest.md rename to samples/client/petstore/java/jersey2-java7/docs/EnumTest.md diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java7/docs/FakeApi.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/FakeApi.md rename to samples/client/petstore/java/jersey2-java7/docs/FakeApi.md diff --git a/samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2-java7/docs/FakeClassnameTags123Api.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md rename to samples/client/petstore/java/jersey2-java7/docs/FakeClassnameTags123Api.md diff --git a/samples/client/petstore/java/jersey2/docs/FileSchemaTestClass.md b/samples/client/petstore/java/jersey2-java7/docs/FileSchemaTestClass.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/FileSchemaTestClass.md rename to samples/client/petstore/java/jersey2-java7/docs/FileSchemaTestClass.md diff --git a/samples/client/petstore/java/jersey2/docs/FormatTest.md b/samples/client/petstore/java/jersey2-java7/docs/FormatTest.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/FormatTest.md rename to samples/client/petstore/java/jersey2-java7/docs/FormatTest.md diff --git a/samples/client/petstore/java/jersey2/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/jersey2-java7/docs/HasOnlyReadOnly.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/HasOnlyReadOnly.md rename to samples/client/petstore/java/jersey2-java7/docs/HasOnlyReadOnly.md diff --git a/samples/client/petstore/java/jersey2/docs/MapTest.md b/samples/client/petstore/java/jersey2-java7/docs/MapTest.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/MapTest.md rename to samples/client/petstore/java/jersey2-java7/docs/MapTest.md diff --git a/samples/client/petstore/java/jersey2/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/jersey2-java7/docs/MixedPropertiesAndAdditionalPropertiesClass.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/MixedPropertiesAndAdditionalPropertiesClass.md rename to samples/client/petstore/java/jersey2-java7/docs/MixedPropertiesAndAdditionalPropertiesClass.md diff --git a/samples/client/petstore/java/jersey2/docs/Model200Response.md b/samples/client/petstore/java/jersey2-java7/docs/Model200Response.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Model200Response.md rename to samples/client/petstore/java/jersey2-java7/docs/Model200Response.md diff --git a/samples/client/petstore/java/jersey2/docs/ModelApiResponse.md b/samples/client/petstore/java/jersey2-java7/docs/ModelApiResponse.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/ModelApiResponse.md rename to samples/client/petstore/java/jersey2-java7/docs/ModelApiResponse.md diff --git a/samples/client/petstore/java/jersey2/docs/ModelReturn.md b/samples/client/petstore/java/jersey2-java7/docs/ModelReturn.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/ModelReturn.md rename to samples/client/petstore/java/jersey2-java7/docs/ModelReturn.md diff --git a/samples/client/petstore/java/jersey2/docs/Name.md b/samples/client/petstore/java/jersey2-java7/docs/Name.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Name.md rename to samples/client/petstore/java/jersey2-java7/docs/Name.md diff --git a/samples/client/petstore/java/jersey2/docs/NumberOnly.md b/samples/client/petstore/java/jersey2-java7/docs/NumberOnly.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/NumberOnly.md rename to samples/client/petstore/java/jersey2-java7/docs/NumberOnly.md diff --git a/samples/client/petstore/java/jersey2/docs/Order.md b/samples/client/petstore/java/jersey2-java7/docs/Order.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Order.md rename to samples/client/petstore/java/jersey2-java7/docs/Order.md diff --git a/samples/client/petstore/java/jersey2/docs/OuterComposite.md b/samples/client/petstore/java/jersey2-java7/docs/OuterComposite.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/OuterComposite.md rename to samples/client/petstore/java/jersey2-java7/docs/OuterComposite.md diff --git a/samples/client/petstore/java/jersey2/docs/OuterEnum.md b/samples/client/petstore/java/jersey2-java7/docs/OuterEnum.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/OuterEnum.md rename to samples/client/petstore/java/jersey2-java7/docs/OuterEnum.md diff --git a/samples/client/petstore/java/jersey2/docs/Pet.md b/samples/client/petstore/java/jersey2-java7/docs/Pet.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Pet.md rename to samples/client/petstore/java/jersey2-java7/docs/Pet.md diff --git a/samples/client/petstore/java/jersey2/docs/PetApi.md b/samples/client/petstore/java/jersey2-java7/docs/PetApi.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/PetApi.md rename to samples/client/petstore/java/jersey2-java7/docs/PetApi.md diff --git a/samples/client/petstore/java/jersey2/docs/ReadOnlyFirst.md b/samples/client/petstore/java/jersey2-java7/docs/ReadOnlyFirst.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/ReadOnlyFirst.md rename to samples/client/petstore/java/jersey2-java7/docs/ReadOnlyFirst.md diff --git a/samples/client/petstore/java/jersey2/docs/SpecialModelName.md b/samples/client/petstore/java/jersey2-java7/docs/SpecialModelName.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/SpecialModelName.md rename to samples/client/petstore/java/jersey2-java7/docs/SpecialModelName.md diff --git a/samples/client/petstore/java/jersey2/docs/StoreApi.md b/samples/client/petstore/java/jersey2-java7/docs/StoreApi.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/StoreApi.md rename to samples/client/petstore/java/jersey2-java7/docs/StoreApi.md diff --git a/samples/client/petstore/java/jersey2/docs/StringBooleanMap.md b/samples/client/petstore/java/jersey2-java7/docs/StringBooleanMap.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/StringBooleanMap.md rename to samples/client/petstore/java/jersey2-java7/docs/StringBooleanMap.md diff --git a/samples/client/petstore/java/jersey2/docs/Tag.md b/samples/client/petstore/java/jersey2-java7/docs/Tag.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/Tag.md rename to samples/client/petstore/java/jersey2-java7/docs/Tag.md diff --git a/samples/client/petstore/java/jersey2/docs/TypeHolderDefault.md b/samples/client/petstore/java/jersey2-java7/docs/TypeHolderDefault.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/TypeHolderDefault.md rename to samples/client/petstore/java/jersey2-java7/docs/TypeHolderDefault.md diff --git a/samples/client/petstore/java/jersey2/docs/TypeHolderExample.md b/samples/client/petstore/java/jersey2-java7/docs/TypeHolderExample.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/TypeHolderExample.md rename to samples/client/petstore/java/jersey2-java7/docs/TypeHolderExample.md diff --git a/samples/client/petstore/java/jersey2/docs/User.md b/samples/client/petstore/java/jersey2-java7/docs/User.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/User.md rename to samples/client/petstore/java/jersey2-java7/docs/User.md diff --git a/samples/client/petstore/java/jersey2/docs/UserApi.md b/samples/client/petstore/java/jersey2-java7/docs/UserApi.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/UserApi.md rename to samples/client/petstore/java/jersey2-java7/docs/UserApi.md diff --git a/samples/client/petstore/java/jersey2/docs/XmlItem.md b/samples/client/petstore/java/jersey2-java7/docs/XmlItem.md similarity index 100% rename from samples/client/petstore/java/jersey2/docs/XmlItem.md rename to samples/client/petstore/java/jersey2-java7/docs/XmlItem.md diff --git a/samples/client/petstore/java/jersey2/git_push.sh b/samples/client/petstore/java/jersey2-java7/git_push.sh similarity index 100% rename from samples/client/petstore/java/jersey2/git_push.sh rename to samples/client/petstore/java/jersey2-java7/git_push.sh diff --git a/samples/client/petstore/java/jersey2/gradle.properties b/samples/client/petstore/java/jersey2-java7/gradle.properties similarity index 100% rename from samples/client/petstore/java/jersey2/gradle.properties rename to samples/client/petstore/java/jersey2-java7/gradle.properties diff --git a/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey2-java7/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.jar rename to samples/client/petstore/java/jersey2-java7/gradle/wrapper/gradle-wrapper.jar diff --git a/samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey2-java7/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from samples/client/petstore/java/jersey2/gradle/wrapper/gradle-wrapper.properties rename to samples/client/petstore/java/jersey2-java7/gradle/wrapper/gradle-wrapper.properties diff --git a/samples/client/petstore/java/jersey2/gradlew b/samples/client/petstore/java/jersey2-java7/gradlew similarity index 100% rename from samples/client/petstore/java/jersey2/gradlew rename to samples/client/petstore/java/jersey2-java7/gradlew diff --git a/samples/client/petstore/java/jersey2/gradlew.bat b/samples/client/petstore/java/jersey2-java7/gradlew.bat similarity index 100% rename from samples/client/petstore/java/jersey2/gradlew.bat rename to samples/client/petstore/java/jersey2-java7/gradlew.bat diff --git a/samples/client/petstore/java/jersey2/pom.xml b/samples/client/petstore/java/jersey2-java7/pom.xml similarity index 99% rename from samples/client/petstore/java/jersey2/pom.xml rename to samples/client/petstore/java/jersey2-java7/pom.xml index b60a851eeaa4..838bba88a15b 100644 --- a/samples/client/petstore/java/jersey2/pom.xml +++ b/samples/client/petstore/java/jersey2-java7/pom.xml @@ -2,9 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 org.openapitools - petstore-jersey2 + petstore-jersey2-java7 jar - petstore-jersey2 + petstore-jersey2-java7 1.0.0 https://github.com/openapitools/openapi-generator OpenAPI Java diff --git a/samples/client/petstore/java/jersey2-java7/settings.gradle b/samples/client/petstore/java/jersey2-java7/settings.gradle new file mode 100644 index 000000000000..c9be41028040 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java7/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-jersey2-java7" \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2/src/main/AndroidManifest.xml b/samples/client/petstore/java/jersey2-java7/src/main/AndroidManifest.xml similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/AndroidManifest.xml rename to samples/client/petstore/java/jersey2-java7/src/main/AndroidManifest.xml diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ApiClient.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ApiClient.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ApiException.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiException.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ApiException.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ApiResponse.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiResponse.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ApiResponse.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/Configuration.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/Configuration.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/Configuration.java diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/CustomInstantDeserializer.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/CustomInstantDeserializer.java similarity index 100% rename from samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/CustomInstantDeserializer.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/CustomInstantDeserializer.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/JSON.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/JSON.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/JSON.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/Pair.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/Pair.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/Pair.java diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/RFC3339DateFormat.java similarity index 100% rename from samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/RFC3339DateFormat.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/RFC3339DateFormat.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ServerConfiguration.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ServerConfiguration.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ServerConfiguration.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ServerVariable.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ServerVariable.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/ServerVariable.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/StringUtil.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/StringUtil.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/StringUtil.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/AnotherFakeApi.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/AnotherFakeApi.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/AnotherFakeApi.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/FakeApi.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/FakeApi.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/PetApi.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/PetApi.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/StoreApi.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/StoreApi.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/UserApi.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/api/UserApi.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/Authentication.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/Authentication.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/Authentication.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java similarity index 100% rename from samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/OAuth.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/OAuth.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/OAuth.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/OAuthFlow.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/OAuthFlow.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/auth/OAuthFlow.java diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java similarity index 100% rename from samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Animal.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Animal.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ArrayTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ArrayTest.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ArrayTest.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/BigCat.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCat.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/BigCat.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/BigCatAllOf.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCatAllOf.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/BigCatAllOf.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Capitalization.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Capitalization.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Capitalization.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Cat.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Cat.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Cat.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/CatAllOf.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/CatAllOf.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/CatAllOf.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Category.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Category.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ClassModel.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ClassModel.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ClassModel.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Client.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Client.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Client.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Dog.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Dog.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Dog.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/DogAllOf.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/DogAllOf.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/DogAllOf.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/EnumArrays.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/EnumArrays.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/EnumClass.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/EnumClass.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/EnumTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/EnumTest.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/FormatTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/FormatTest.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/FormatTest.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/MapTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/MapTest.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Model200Response.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Model200Response.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Model200Response.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ModelApiResponse.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelApiResponse.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ModelApiResponse.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ModelReturn.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelReturn.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ModelReturn.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Name.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Name.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Name.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/NumberOnly.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/NumberOnly.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/NumberOnly.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Order.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Order.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/OuterComposite.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterComposite.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/OuterComposite.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/OuterEnum.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/OuterEnum.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Pet.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Pet.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/SpecialModelName.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/SpecialModelName.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/SpecialModelName.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Tag.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Tag.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/Tag.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/TypeHolderDefault.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/TypeHolderDefault.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/TypeHolderExample.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/TypeHolderExample.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/TypeHolderExample.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/User.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/User.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/User.java diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/XmlItem.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/XmlItem.java rename to samples/client/petstore/java/jersey2-java7/src/main/java/org/openapitools/client/model/XmlItem.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/FakeApiTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/FakeApiTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/FakeApiTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/PetApiTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/PetApiTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/PetApiTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/StoreApiTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/StoreApiTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/StoreApiTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/UserApiTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/api/UserApiTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/api/UserApiTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AnimalTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/AnimalTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/AnimalTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ArrayTestTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ArrayTestTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ArrayTestTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/BigCatTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/BigCatTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/CapitalizationTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/CapitalizationTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/CapitalizationTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/CatAllOfTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/CatAllOfTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/CatAllOfTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/CatAllOfTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/CatTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/CatTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/CatTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/CategoryTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/CategoryTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/CategoryTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ClassModelTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ClassModelTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ClassModelTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ClientTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ClientTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ClientTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/DogAllOfTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/DogAllOfTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/DogAllOfTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/DogAllOfTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/DogTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/DogTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/DogTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/EnumArraysTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/EnumArraysTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/EnumArraysTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/EnumClassTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/EnumClassTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/EnumClassTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/EnumTestTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/EnumTestTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/EnumTestTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/FormatTestTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/FormatTestTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/FormatTestTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/MapTestTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/MapTestTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/MapTestTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/Model200ResponseTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/Model200ResponseTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/Model200ResponseTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ModelReturnTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ModelReturnTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ModelReturnTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/NameTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/NameTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/NameTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/NumberOnlyTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/NumberOnlyTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/NumberOnlyTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/OrderTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/OrderTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/OrderTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/OuterCompositeTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/OuterCompositeTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/OuterCompositeTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/OuterEnumTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/OuterEnumTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/OuterEnumTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/PetTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/PetTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/PetTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/TagTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/TagTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/TagTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/UserTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/UserTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/XmlItemTest.java similarity index 100% rename from samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/XmlItemTest.java rename to samples/client/petstore/java/jersey2-java7/src/test/java/org/openapitools/client/model/XmlItemTest.java diff --git a/samples/client/petstore/java/jersey2/settings.gradle b/samples/client/petstore/java/jersey2/settings.gradle deleted file mode 100644 index 0ddcd580a4a1..000000000000 --- a/samples/client/petstore/java/jersey2/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "petstore-jersey2" \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/CustomInstantDeserializer.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/CustomInstantDeserializer.java deleted file mode 100644 index 83d4514b071b..000000000000 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/CustomInstantDeserializer.java +++ /dev/null @@ -1,232 +0,0 @@ -package org.openapitools.client; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonTokenId; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; -import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; -import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; -import com.fasterxml.jackson.datatype.threetenbp.function.Function; -import org.threeten.bp.DateTimeException; -import org.threeten.bp.DateTimeUtils; -import org.threeten.bp.Instant; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.ZoneId; -import org.threeten.bp.ZonedDateTime; -import org.threeten.bp.format.DateTimeFormatter; -import org.threeten.bp.temporal.Temporal; -import org.threeten.bp.temporal.TemporalAccessor; - -import java.io.IOException; -import java.math.BigDecimal; - -/** - * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. - * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. - * - * @author Nick Williams - */ -public class CustomInstantDeserializer - extends ThreeTenDateTimeDeserializerBase { - private static final long serialVersionUID = 1L; - - public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( - Instant.class, DateTimeFormatter.ISO_INSTANT, - new Function() { - @Override - public Instant apply(TemporalAccessor temporalAccessor) { - return Instant.from(temporalAccessor); - } - }, - new Function() { - @Override - public Instant apply(FromIntegerArguments a) { - return Instant.ofEpochMilli(a.value); - } - }, - new Function() { - @Override - public Instant apply(FromDecimalArguments a) { - return Instant.ofEpochSecond(a.integer, a.fraction); - } - }, - null - ); - - public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( - OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, - new Function() { - @Override - public OffsetDateTime apply(TemporalAccessor temporalAccessor) { - return OffsetDateTime.from(temporalAccessor); - } - }, - new Function() { - @Override - public OffsetDateTime apply(FromIntegerArguments a) { - return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); - } - }, - new Function() { - @Override - public OffsetDateTime apply(FromDecimalArguments a) { - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); - } - }, - new BiFunction() { - @Override - public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { - return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); - } - } - ); - - public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( - ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, - new Function() { - @Override - public ZonedDateTime apply(TemporalAccessor temporalAccessor) { - return ZonedDateTime.from(temporalAccessor); - } - }, - new Function() { - @Override - public ZonedDateTime apply(FromIntegerArguments a) { - return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); - } - }, - new Function() { - @Override - public ZonedDateTime apply(FromDecimalArguments a) { - return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); - } - }, - new BiFunction() { - @Override - public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { - return zonedDateTime.withZoneSameInstant(zoneId); - } - } - ); - - protected final Function fromMilliseconds; - - protected final Function fromNanoseconds; - - protected final Function parsedToValue; - - protected final BiFunction adjust; - - protected CustomInstantDeserializer(Class supportedType, - DateTimeFormatter parser, - Function parsedToValue, - Function fromMilliseconds, - Function fromNanoseconds, - BiFunction adjust) { - super(supportedType, parser); - this.parsedToValue = parsedToValue; - this.fromMilliseconds = fromMilliseconds; - this.fromNanoseconds = fromNanoseconds; - this.adjust = adjust == null ? new BiFunction() { - @Override - public T apply(T t, ZoneId zoneId) { - return t; - } - } : adjust; - } - - @SuppressWarnings("unchecked") - protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { - super((Class) base.handledType(), f); - parsedToValue = base.parsedToValue; - fromMilliseconds = base.fromMilliseconds; - fromNanoseconds = base.fromNanoseconds; - adjust = base.adjust; - } - - @Override - protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { - if (dtf == _formatter) { - return this; - } - return new CustomInstantDeserializer(this, dtf); - } - - @Override - public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { - //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only - //string values have to be adjusted to the configured TZ. - switch (parser.getCurrentTokenId()) { - case JsonTokenId.ID_NUMBER_FLOAT: { - BigDecimal value = parser.getDecimalValue(); - long seconds = value.longValue(); - int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); - return fromNanoseconds.apply(new FromDecimalArguments( - seconds, nanoseconds, getZone(context))); - } - - case JsonTokenId.ID_NUMBER_INT: { - long timestamp = parser.getLongValue(); - if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { - return this.fromNanoseconds.apply(new FromDecimalArguments( - timestamp, 0, this.getZone(context) - )); - } - return this.fromMilliseconds.apply(new FromIntegerArguments( - timestamp, this.getZone(context) - )); - } - - case JsonTokenId.ID_STRING: { - String string = parser.getText().trim(); - if (string.length() == 0) { - return null; - } - if (string.endsWith("+0000")) { - string = string.substring(0, string.length() - 5) + "Z"; - } - T value; - try { - TemporalAccessor acc = _formatter.parse(string); - value = parsedToValue.apply(acc); - if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { - return adjust.apply(value, this.getZone(context)); - } - } catch (DateTimeException e) { - throw _peelDTE(e); - } - return value; - } - } - throw context.mappingException("Expected type float, integer, or string."); - } - - private ZoneId getZone(DeserializationContext context) { - // Instants are always in UTC, so don't waste compute cycles - return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); - } - - private static class FromIntegerArguments { - public final long value; - public final ZoneId zoneId; - - private FromIntegerArguments(long value, ZoneId zoneId) { - this.value = value; - this.zoneId = zoneId; - } - } - - private static class FromDecimalArguments { - public final long integer; - public final int fraction; - public final ZoneId zoneId; - - private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { - this.integer = integer; - this.fraction = fraction; - this.zoneId = zoneId; - } - } -} diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/RFC3339DateFormat.java deleted file mode 100644 index 9509fd089812..000000000000 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/RFC3339DateFormat.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package org.openapitools.client; - -import com.fasterxml.jackson.databind.util.ISO8601DateFormat; -import com.fasterxml.jackson.databind.util.ISO8601Utils; - -import java.text.FieldPosition; -import java.util.Date; - - -public class RFC3339DateFormat extends ISO8601DateFormat { - - // Same as ISO8601DateFormat but serializing milliseconds. - @Override - public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - String value = ISO8601Utils.format(date, true); - toAppendTo.append(value); - return toAppendTo; - } - -} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java deleted file mode 100644 index 336d15934686..000000000000 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.auth; - -import org.openapitools.client.Pair; -import org.openapitools.client.ApiException; - -import java.net.URI; -import java.net.URLEncoder; -import java.security.MessageDigest; -import java.security.Key; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Date; -import java.util.Locale; -import java.util.Map; -import java.util.List; - -import org.tomitribe.auth.signatures.*; - -/** - * A Configuration object for the HTTP message signature security scheme. - */ -public class HttpSignatureAuth implements Authentication { - - private Signer signer; - - // An opaque string that the server can use to look up the component they need to validate the signature. - private String keyId; - - // The HTTP signature algorithm. - private Algorithm algorithm; - - // The list of HTTP headers that should be included in the HTTP signature. - private List headers; - - // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. - private String digestAlgorithm; - - /** - * Construct a new HTTP signature auth configuration object. - * - * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. - * @param algorithm The signature algorithm. - * @param headers The list of HTTP headers that should be included in the HTTP signature. - */ - public HttpSignatureAuth(String keyId, Algorithm algorithm, List headers) { - this.keyId = keyId; - this.algorithm = algorithm; - this.headers = headers; - this.digestAlgorithm = "SHA-256"; - } - - /** - * Returns the opaque string that the server can use to look up the component they need to validate the signature. - * - * @return The keyId. - */ - public String getKeyId() { - return keyId; - } - - /** - * Set the HTTP signature key id. - * - * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. - */ - public void setKeyId(String keyId) { - this.keyId = keyId; - } - - /** - * Returns the HTTP signature algorithm which is used to sign HTTP requests. - */ - public Algorithm getAlgorithm() { - return algorithm; - } - - /** - * Sets the HTTP signature algorithm which is used to sign HTTP requests. - * - * @param algorithm The HTTP signature algorithm. - */ - public void setAlgorithm(Algorithm algorithm) { - this.algorithm = algorithm; - } - - /** - * Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. - * - * @see java.security.MessageDigest - */ - public String getDigestAlgorithm() { - return digestAlgorithm; - } - - /** - * Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. - * - * The exact list of supported digest algorithms depends on the installed security providers. - * Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256". - * Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks. - * By default, "SHA-256" is used. - * - * @param digestAlgorithm The digest algorithm. - * - * @see java.security.MessageDigest - */ - public void setDigestAlgorithm(String digestAlgorithm) { - this.digestAlgorithm = digestAlgorithm; - } - - /** - * Returns the list of HTTP headers that should be included in the HTTP signature. - */ - public List getHeaders() { - return headers; - } - - /** - * Sets the list of HTTP headers that should be included in the HTTP signature. - * - * @param headers The HTTP headers. - */ - public void setHeaders(List headers) { - this.headers = headers; - } - - public Signer getSigner() { - return signer; - } - - public void setSigner(Signer signer) { - this.signer = signer; - } - - /** - * Set the private key used to sign HTTP requests using the HTTP signature scheme. - * - * @param key The private key. - */ - public void setPrivateKey(Key key) throws ApiException { - if (key == null) { - throw new ApiException("Private key (java.security.Key) cannot be null"); - } - - signer = new Signer(key, new Signature(keyId, algorithm, null, headers)); - } - - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - try { - if (headers.contains("host")) { - headerParams.put("host", uri.getHost()); - } - - if (headers.contains("date")) { - headerParams.put("date", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date())); - } - - if (headers.contains("digest")) { - headerParams.put("digest", - this.digestAlgorithm + "=" + - new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes())))); - } - - if (signer == null) { - throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly"); - } - - // construct the path with the URL query string - String path = uri.getPath(); - - List urlQueries = new ArrayList(); - for (Pair queryParam : queryParams) { - urlQueries.add(queryParam.getName() + "=" + URLEncoder.encode(queryParam.getValue(), "utf8").replaceAll("\\+", "%20")); - } - - if (!urlQueries.isEmpty()) { - path = path + "?" + String.join("&", urlQueries); - } - - headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); - } catch (Exception ex) { - throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString()); - } - } -} diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java deleted file mode 100644 index 3e95f2d66f7c..000000000000 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated 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.lang.reflect.Type; -import java.util.Map; -import javax.ws.rs.core.GenericType; - -/** - * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec - */ - -public abstract class AbstractOpenApiSchema { - - // store the actual instance of the schema/object - private Object instance; - - // is nullable - private Boolean isNullable; - - // schema type (e.g. oneOf, anyOf) - private final String schemaType; - - public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { - this.schemaType = schemaType; - this.isNullable = isNullable; - } - - /*** - * Get the list of schemas allowed to be stored in this object - * - * @return an instance of the actual schema/object - */ - public abstract Map getSchemas(); - - /*** - * Get the actual instance - * - * @return an instance of the actual schema/object - */ - public Object getActualInstance() {return instance;} - - /*** - * Set the actual instance - * - * @param instance the actual instance of the schema/object - */ - public void setActualInstance(Object instance) {this.instance = instance;} - - /*** - * Get the schema type (e.g. anyOf, oneOf) - * - * @return the schema type - */ - public String getSchemaType() { - return schemaType; - } - - /*** - * Is nullalble - * - * @return true if it's nullable - */ - public Boolean isNullable() { - if (Boolean.TRUE.equals(isNullable)) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } -}