forked from loafle/openapi-generator-original
[java] Intro openApiNullable property to enable/disable OpenAPI Jackson Nullable library (#6154)
* Add option to prevent usage of jackson-nullable (#2901) Add a option for all java client and server to prevent usage of third party library (jackson-databind-nullable) which may be forbidden in some company Add samples for Vertx, Spring MVC, Spring Cloud, Feign and Play Upgrade dependencies for org.openapitools:jackson-databind-nullable * Samples - Remove dependency org.openapitools:jackson-databind-nullable (#2901) * Fix generation of gradle file for vertx (#2901) * Regenerate samples (#2901) * Fix documentation and up to date (#2901) * Fix forgotten regeneration of vertx after dependency integration (#2901) * Regenerate template after rebase (#2901) * Use yaml config files introduce in #6509 to manage samples (#2901) * Regenerate template using the config (#2901) * Fix bad version during testing generated samples (#2901) * Regenerate template after fix bad version (#2901) * Fix merge, allow for set importing on codegen model Co-authored-by: Jim Schubert <james.schubert@gmail.com>
This commit is contained in:
parent
7032c401ea
commit
b9662dc25d
11
bin/configs/java-feign-no-nullable.yaml
Normal file
11
bin/configs/java-feign-no-nullable.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
generatorName: java
|
||||||
|
outputDir: samples/client/petstore/java/feign-no-nullable
|
||||||
|
library: feign
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
|
additionalProperties:
|
||||||
|
booleanGetterPrefix: is
|
||||||
|
artifactId: petstore-feign-no-nullable
|
||||||
|
hideGenerationTimestamp: "true"
|
||||||
|
additionalModelTypeAnnotations: '@javax.annotation.concurrent.Immutable'
|
||||||
|
openApiNullable: "false"
|
7
bin/configs/java-play-framework-no-nullable.yaml
Normal file
7
bin/configs/java-play-framework-no-nullable.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
generatorName: java-play-framework
|
||||||
|
outputDir: samples/server/petstore/java-play-framework-no-nullable
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/JavaPlayFramework
|
||||||
|
additionalProperties:
|
||||||
|
hideGenerationTimestamp: "true"
|
||||||
|
openApiNullable: "false"
|
9
bin/configs/java-vertx-no-nullable.yaml
Normal file
9
bin/configs/java-vertx-no-nullable.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
generatorName: java
|
||||||
|
outputDir: samples/client/petstore/java/vertx-no-nullable
|
||||||
|
library: vertx
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
|
additionalProperties:
|
||||||
|
artifactId: petstore-vertx-no-nullable
|
||||||
|
hideGenerationTimestamp: "true"
|
||||||
|
openApiNullable: "false"
|
11
bin/configs/spring-boot-beanvalidation-no-nullable.yaml
Normal file
11
bin/configs/spring-boot-beanvalidation-no-nullable.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
generatorName: spring
|
||||||
|
outputDir: samples/server/petstore/springboot-beanvalidation-no-nullable
|
||||||
|
library: spring-boot
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||||
|
additionalProperties:
|
||||||
|
java8: "false"
|
||||||
|
useBeanValidation: true
|
||||||
|
artifactId: spring-boot-beanvalidation-no-nullable
|
||||||
|
hideGenerationTimestamp: "true"
|
||||||
|
openApiNullable: "false"
|
10
bin/configs/spring-cloud-no-nullable.yaml
Normal file
10
bin/configs/spring-cloud-no-nullable.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
generatorName: spring
|
||||||
|
outputDir: samples/client/petstore/spring-cloud-no-nullable
|
||||||
|
library: spring-cloud
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud
|
||||||
|
additionalProperties:
|
||||||
|
artifactId: petstore-spring-cloud-no-nullable
|
||||||
|
responseWrapper: HystrixCommand
|
||||||
|
hideGenerationTimestamp: "true"
|
||||||
|
openApiNullable: "false"
|
10
bin/configs/spring-mvc-no-nullable.yaml
Normal file
10
bin/configs/spring-mvc-no-nullable.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
generatorName: spring
|
||||||
|
outputDir: samples/server/petstore/spring-mvc-no-nullable
|
||||||
|
library: spring-mvc
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||||
|
additionalProperties:
|
||||||
|
artifactId: spring-mvc-server-no-nullable
|
||||||
|
openApiNullable: "false"
|
||||||
|
serverPort: "8002"
|
||||||
|
hideGenerationTimestamp: "true"
|
@ -30,6 +30,7 @@ sidebar_label: groovy
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -32,6 +32,7 @@ sidebar_label: java-inflector
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -34,6 +34,7 @@ sidebar_label: java-msf4j
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -34,6 +34,7 @@ sidebar_label: java-pkmst
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |com.prokarma.pkmst.model|
|
|modelPackage|package for generated models| |com.prokarma.pkmst.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -36,6 +36,7 @@ sidebar_label: java-play-framework
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |apimodels|
|
|modelPackage|package for generated models| |apimodels|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -32,6 +32,7 @@ sidebar_label: java-undertow-server
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |null|
|
|modelPackage|package for generated models| |null|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -32,6 +32,7 @@ sidebar_label: java-vertx-web
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.vertxweb.server.model|
|
|modelPackage|package for generated models| |org.openapitools.vertxweb.server.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -32,6 +32,7 @@ sidebar_label: java-vertx
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.server.api.model|
|
|modelPackage|package for generated models| |org.openapitools.server.api.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -36,6 +36,7 @@ sidebar_label: java
|
|||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
|
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
|
||||||
|modelPackage|package for generated models| |org.openapitools.client.model|
|
|modelPackage|package for generated models| |org.openapitools.client.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false|
|
|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -37,6 +37,7 @@ sidebar_label: jaxrs-cxf-cdi
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|openApiSpecFileLocation|Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string.| |null|
|
|openApiSpecFileLocation|Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string.| |null|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -32,6 +32,7 @@ sidebar_label: jaxrs-cxf-client
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -40,6 +40,7 @@ sidebar_label: jaxrs-cxf-extended
|
|||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|loadTestDataFromFile|Load test data from a generated JSON file| |false|
|
|loadTestDataFromFile|Load test data from a generated JSON file| |false|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -38,6 +38,7 @@ sidebar_label: jaxrs-cxf
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -34,6 +34,7 @@ sidebar_label: jaxrs-jersey
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -34,6 +34,7 @@ sidebar_label: jaxrs-resteasy-eap
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -34,6 +34,7 @@ sidebar_label: jaxrs-resteasy
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -37,6 +37,7 @@ sidebar_label: jaxrs-spec
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|openApiSpecFileLocation|Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string.| |null|
|
|openApiSpecFileLocation|Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string.| |null|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -41,6 +41,7 @@ sidebar_label: spring
|
|||||||
|licenseName|The name of the license| |Unlicense|
|
|licenseName|The name of the license| |Unlicense|
|
||||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||||
|modelPackage|package for generated models| |org.openapitools.model|
|
|modelPackage|package for generated models| |org.openapitools.model|
|
||||||
|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||||
|
@ -61,6 +61,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
public static final String BOOLEAN_GETTER_PREFIX = "booleanGetterPrefix";
|
public static final String BOOLEAN_GETTER_PREFIX = "booleanGetterPrefix";
|
||||||
public static final String ADDITIONAL_MODEL_TYPE_ANNOTATIONS = "additionalModelTypeAnnotations";
|
public static final String ADDITIONAL_MODEL_TYPE_ANNOTATIONS = "additionalModelTypeAnnotations";
|
||||||
public static final String DISCRIMINATOR_CASE_SENSITIVE = "discriminatorCaseSensitive";
|
public static final String DISCRIMINATOR_CASE_SENSITIVE = "discriminatorCaseSensitive";
|
||||||
|
public static final String OPENAPI_NULLABLE = "openApiNullable";
|
||||||
|
|
||||||
protected String dateLibrary = "threetenbp";
|
protected String dateLibrary = "threetenbp";
|
||||||
protected boolean supportAsync = false;
|
protected boolean supportAsync = false;
|
||||||
@ -100,6 +101,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
protected String parentVersion = "";
|
protected String parentVersion = "";
|
||||||
protected boolean parentOverridden = false;
|
protected boolean parentOverridden = false;
|
||||||
protected List<String> additionalModelTypeAnnotations = new LinkedList<>();
|
protected List<String> additionalModelTypeAnnotations = new LinkedList<>();
|
||||||
|
protected boolean openApiNullable = true;
|
||||||
|
|
||||||
public AbstractJavaCodegen() {
|
public AbstractJavaCodegen() {
|
||||||
super();
|
super();
|
||||||
@ -218,6 +220,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
cliOptions.add(CliOption.newBoolean(DISABLE_HTML_ESCAPING, "Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)", disableHtmlEscaping));
|
cliOptions.add(CliOption.newBoolean(DISABLE_HTML_ESCAPING, "Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)", disableHtmlEscaping));
|
||||||
cliOptions.add(CliOption.newString(BOOLEAN_GETTER_PREFIX, "Set booleanGetterPrefix").defaultValue(this.getBooleanGetterPrefix()));
|
cliOptions.add(CliOption.newString(BOOLEAN_GETTER_PREFIX, "Set booleanGetterPrefix").defaultValue(this.getBooleanGetterPrefix()));
|
||||||
cliOptions.add(CliOption.newString(ADDITIONAL_MODEL_TYPE_ANNOTATIONS, "Additional annotations for model type(class level annotations)"));
|
cliOptions.add(CliOption.newString(ADDITIONAL_MODEL_TYPE_ANNOTATIONS, "Additional annotations for model type(class level annotations)"));
|
||||||
|
cliOptions.add(CliOption.newBoolean(OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library", this.openApiNullable));
|
||||||
|
|
||||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
|
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
|
||||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
|
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
|
||||||
@ -412,6 +415,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
}
|
}
|
||||||
additionalProperties.put(WITH_XML, withXml);
|
additionalProperties.put(WITH_XML, withXml);
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey(OPENAPI_NULLABLE)) {
|
||||||
|
this.setOpenApiNullable(Boolean.valueOf(additionalProperties.get(OPENAPI_NULLABLE).toString()));
|
||||||
|
}
|
||||||
|
additionalProperties.put(OPENAPI_NULLABLE, openApiNullable);
|
||||||
|
|
||||||
if (additionalProperties.containsKey(CodegenConstants.PARENT_GROUP_ID)) {
|
if (additionalProperties.containsKey(CodegenConstants.PARENT_GROUP_ID)) {
|
||||||
this.setParentGroupId((String) additionalProperties.get(CodegenConstants.PARENT_GROUP_ID));
|
this.setParentGroupId((String) additionalProperties.get(CodegenConstants.PARENT_GROUP_ID));
|
||||||
}
|
}
|
||||||
@ -1507,6 +1515,14 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
this.booleanGetterPrefix = booleanGetterPrefix;
|
this.booleanGetterPrefix = booleanGetterPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isOpenApiNullable() {
|
||||||
|
return openApiNullable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenApiNullable(final boolean openApiNullable) {
|
||||||
|
this.openApiNullable = openApiNullable;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String escapeQuotationMark(String input) {
|
public String escapeQuotationMark(String input) {
|
||||||
// remove " to avoid code injection
|
// remove " to avoid code injection
|
||||||
|
@ -779,11 +779,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||||
boolean addImports = false;
|
boolean addImports = false;
|
||||||
|
|
||||||
for (CodegenProperty var : cm.vars) {
|
for (CodegenProperty var : cm.vars) {
|
||||||
boolean isOptionalNullable = Boolean.FALSE.equals(var.required) && Boolean.TRUE.equals(var.isNullable);
|
if (this.openApiNullable) {
|
||||||
// only add JsonNullable and related imports to optional and nullable values
|
boolean isOptionalNullable = Boolean.FALSE.equals(var.required) && Boolean.TRUE.equals(var.isNullable);
|
||||||
addImports |= isOptionalNullable;
|
// only add JsonNullable and related imports to optional and nullable values
|
||||||
var.getVendorExtensions().put("x-is-jackson-optional-nullable", isOptionalNullable);
|
addImports |= isOptionalNullable;
|
||||||
|
var.getVendorExtensions().put("x-is-jackson-optional-nullable", isOptionalNullable);
|
||||||
|
}
|
||||||
|
|
||||||
if (Boolean.TRUE.equals(var.getVendorExtensions().get("x-enum-as-string"))) {
|
if (Boolean.TRUE.equals(var.getVendorExtensions().get("x-enum-as-string"))) {
|
||||||
// treat enum string as just string
|
// treat enum string as just string
|
||||||
@ -808,6 +811,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
importsHashSet.put("import", "java.util.HashSet");
|
importsHashSet.put("import", "java.util.HashSet");
|
||||||
imports.add(importsHashSet);
|
imports.add(importsHashSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addImports) {
|
if (addImports) {
|
||||||
@ -824,34 +828,34 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// add implements for serializable/parcelable to all models
|
// add implements for serializable/parcelable to all models
|
||||||
for (Object _mo : models) {
|
for (Object _mo : models) {
|
||||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||||
|
|
||||||
cm.getVendorExtensions().putIfAbsent("x-implements", new ArrayList<String>());
|
cm.getVendorExtensions().putIfAbsent("x-implements", new ArrayList<String>());
|
||||||
if (JERSEY2.equals(getLibrary())) {
|
if (JERSEY2.equals(getLibrary())) {
|
||||||
cm.getVendorExtensions().put("x-implements", new ArrayList<String>());
|
cm.getVendorExtensions().put("x-implements", new ArrayList<String>());
|
||||||
|
|
||||||
if (cm.oneOf != null && !cm.oneOf.isEmpty() && cm.oneOf.contains("ModelNull")) {
|
if (cm.oneOf != null && !cm.oneOf.isEmpty() && cm.oneOf.contains("ModelNull")) {
|
||||||
// if oneOf contains "null" type
|
// if oneOf contains "null" type
|
||||||
cm.isNullable = true;
|
cm.isNullable = true;
|
||||||
cm.oneOf.remove("ModelNull");
|
cm.oneOf.remove("ModelNull");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cm.anyOf != null && !cm.anyOf.isEmpty() && cm.anyOf.contains("ModelNull")) {
|
||||||
|
// if anyOf contains "null" type
|
||||||
|
cm.isNullable = true;
|
||||||
|
cm.anyOf.remove("ModelNull");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (this.parcelableModel) {
|
||||||
if (cm.anyOf != null && !cm.anyOf.isEmpty() && cm.anyOf.contains("ModelNull")) {
|
((ArrayList<String>) cm.getVendorExtensions().get("x-implements")).add("Parcelable");
|
||||||
// if anyOf contains "null" type
|
}
|
||||||
cm.isNullable = true;
|
if (this.serializableModel) {
|
||||||
cm.anyOf.remove("ModelNull");
|
((ArrayList<String>) cm.getVendorExtensions().get("x-implements")).add("Serializable");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (this.parcelableModel) {
|
|
||||||
((ArrayList<String>) cm.getVendorExtensions().get("x-implements")).add("Parcelable");
|
|
||||||
}
|
|
||||||
if (this.serializableModel) {
|
|
||||||
((ArrayList<String>) cm.getVendorExtensions().get("x-implements")).add("Serializable");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -951,8 +955,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
setSerializationLibrary(serializationLibrary);
|
setSerializationLibrary(serializationLibrary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
||||||
generateYAMLSpecFile(objs);
|
generateYAMLSpecFile(objs);
|
||||||
|
@ -138,7 +138,9 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.10.3"
|
jackson_version = "2.10.3"
|
||||||
jackson_databind_version = "2.10.4"
|
jackson_databind_version = "2.10.4"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
jackson_threetenbp_version = "2.9.10"
|
jackson_threetenbp_version = "2.9.10"
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
@ -156,7 +158,9 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
|
@ -15,7 +15,9 @@ import org.threeten.bp.*;
|
|||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
@ -181,8 +183,10 @@ public class ApiClient {
|
|||||||
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
||||||
objectMapper.registerModule(module);
|
objectMapper.registerModule(module);
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
objectMapper.registerModule(jnm);
|
objectMapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,9 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.24"
|
swagger_annotations_version = "1.5.24"
|
||||||
jackson_version = "2.10.3"
|
jackson_version = "2.10.3"
|
||||||
jackson_databind_version = "2.10.3"
|
jackson_databind_version = "2.10.3"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
jackson_threetenbp_version = "2.9.10"
|
jackson_threetenbp_version = "2.9.10"
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
@ -142,7 +144,9 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.core:jackson-core:$jackson_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-annotations:$jackson_version"
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
|
@ -274,11 +274,13 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson-databind-version}</version>
|
<version>${jackson-databind-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>${jackson-databind-nullable-version}</version>
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#withXml}}
|
{{#withXml}}
|
||||||
|
|
||||||
<!-- XML Support -->
|
<!-- XML Support -->
|
||||||
@ -351,7 +353,9 @@
|
|||||||
<feign-version>10.11</feign-version>
|
<feign-version>10.11</feign-version>
|
||||||
<feign-form-version>3.8.0</feign-form-version>
|
<feign-form-version>3.8.0</feign-form-version>
|
||||||
<jackson-version>2.10.3</jackson-version>
|
<jackson-version>2.10.3</jackson-version>
|
||||||
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
|
{{/openApiNullable}}
|
||||||
<jackson-databind-version>2.10.3</jackson-databind-version>
|
<jackson-databind-version>2.10.3</jackson-databind-version>
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
|
@ -4,7 +4,9 @@ import {{apiPackage}}.*;
|
|||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
@ -54,8 +56,10 @@ public class ApiClient {
|
|||||||
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
||||||
objectMapper.registerModule(module);
|
objectMapper.registerModule(module);
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
objectMapper.registerModule(jnm);
|
objectMapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,9 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.10.1"
|
jackson_version = "2.10.1"
|
||||||
jackson_databind_version = "2.10.4"
|
jackson_databind_version = "2.10.4"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
google_api_client_version = "1.23.0"
|
google_api_client_version = "1.23.0"
|
||||||
jersey_common_version = "2.25.1"
|
jersey_common_version = "2.25.1"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
@ -141,7 +143,9 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#java8}}
|
{{#java8}}
|
||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
|
@ -267,11 +267,13 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson-version}</version>
|
<version>${jackson-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>${jackson-databind-nullable-version}</version>
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#withXml}}
|
{{#withXml}}
|
||||||
<!-- XML processing: Jackson -->
|
<!-- XML processing: Jackson -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -328,7 +330,9 @@
|
|||||||
<jersey-common-version>2.25.1</jersey-common-version>
|
<jersey-common-version>2.25.1</jersey-common-version>
|
||||||
<jackson-version>2.10.4</jackson-version>
|
<jackson-version>2.10.4</jackson-version>
|
||||||
<jackson-databind-version>2.10.4</jackson-databind-version>
|
<jackson-databind-version>2.10.4</jackson-databind-version>
|
||||||
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
<jodatime-version>2.9.9</jodatime-version>
|
<jodatime-version>2.9.9</jodatime-version>
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
|
@ -5,7 +5,9 @@ import org.threeten.bp.*;
|
|||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
import com.fasterxml.jackson.annotation.*;
|
import com.fasterxml.jackson.annotation.*;
|
||||||
import com.fasterxml.jackson.databind.*;
|
import com.fasterxml.jackson.databind.*;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#java8}}
|
{{#java8}}
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
@ -54,8 +56,10 @@ public class JSON implements ContextResolver<ObjectMapper> {
|
|||||||
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
||||||
mapper.registerModule(module);
|
mapper.registerModule(module);
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
mapper.registerModule(jnm);
|
mapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +121,9 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.10.3"
|
jackson_version = "2.10.3"
|
||||||
jackson_databind_version = "2.10.4"
|
jackson_databind_version = "2.10.4"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#supportJava6}}
|
{{#supportJava6}}
|
||||||
jersey_version = "2.6"
|
jersey_version = "2.6"
|
||||||
commons_io_version=2.5
|
commons_io_version=2.5
|
||||||
@ -152,7 +154,9 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.core:jackson-core:$jackson_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-annotations:$jackson_version"
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
|
@ -296,11 +296,13 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson-databind-version}</version>
|
<version>${jackson-databind-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>${jackson-databind-nullable-version}</version>
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#withXml}}
|
{{#withXml}}
|
||||||
<!-- XML processing: JAXB -->
|
<!-- XML processing: JAXB -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,9 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@ -155,8 +157,10 @@ public class ApiClient {
|
|||||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
mapper.registerModule(new JavaTimeModule());
|
mapper.registerModule(new JavaTimeModule());
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
mapper.registerModule(jnm);
|
mapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
URI baseURI = URI.create("{{{basePath}}}");
|
URI baseURI = URI.create("{{{basePath}}}");
|
||||||
scheme = baseURI.getScheme();
|
scheme = baseURI.getScheme();
|
||||||
host = baseURI.getHost();
|
host = baseURI.getHost();
|
||||||
|
@ -7,7 +7,9 @@ import org.threeten.bp.*;
|
|||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
import com.fasterxml.jackson.annotation.*;
|
import com.fasterxml.jackson.annotation.*;
|
||||||
import com.fasterxml.jackson.databind.*;
|
import com.fasterxml.jackson.databind.*;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#java8}}
|
{{#java8}}
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
@ -52,8 +54,10 @@ public class JacksonObjectMapper extends Jackson2Mapper {
|
|||||||
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
||||||
mapper.registerModule(module);
|
mapper.registerModule(module);
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
mapper.registerModule(jnm);
|
mapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
return mapper;
|
return mapper;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,9 @@ ext {
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
jackson_version = "2.10.3"
|
jackson_version = "2.10.3"
|
||||||
jackson_databind_version = "2.10.3"
|
jackson_databind_version = "2.10.3"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
jackson_threetenbp_version = "2.10.0"
|
jackson_threetenbp_version = "2.10.0"
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
@ -128,7 +130,9 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#withXml}}
|
{{#withXml}}
|
||||||
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
|
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
|
||||||
{{/withXml}}
|
{{/withXml}}
|
||||||
|
@ -17,7 +17,9 @@ lazy val root = (project in file(".")).
|
|||||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.3",
|
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.3",
|
||||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3",
|
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3",
|
||||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3",
|
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3",
|
||||||
|
{{#openApiNullable}}
|
||||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#withXml}}
|
{{#withXml}}
|
||||||
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.10.3",
|
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.10.3",
|
||||||
{{/withXml}}
|
{{/withXml}}
|
||||||
|
@ -2,7 +2,9 @@ package {{invokerPackage}};
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.*;
|
import com.fasterxml.jackson.annotation.*;
|
||||||
import com.fasterxml.jackson.databind.*;
|
import com.fasterxml.jackson.databind.*;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#java8}}
|
{{#java8}}
|
||||||
import com.fasterxml.jackson.datatype.jsr310.*;
|
import com.fasterxml.jackson.datatype.jsr310.*;
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
@ -27,8 +29,10 @@ public class JSON implements ContextResolver<ObjectMapper> {
|
|||||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
mapper.setDateFormat(new RFC3339DateFormat());
|
mapper.setDateFormat(new RFC3339DateFormat());
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
mapper.registerModule(jnm);
|
mapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#java8}}
|
{{#java8}}
|
||||||
mapper.registerModule(new JavaTimeModule());
|
mapper.registerModule(new JavaTimeModule());
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
|
@ -121,7 +121,9 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.10.4"
|
jackson_version = "2.10.4"
|
||||||
jackson_databind_version = "2.10.4"
|
jackson_databind_version = "2.10.4"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
threetenbp_version = "2.9.10"
|
threetenbp_version = "2.9.10"
|
||||||
resteasy_version = "3.1.3.Final"
|
resteasy_version = "3.1.3.Final"
|
||||||
{{^java8}}
|
{{^java8}}
|
||||||
@ -144,7 +146,9 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
|
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#java8}}
|
{{#java8}}
|
||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
|
@ -226,11 +226,13 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson-databind-version}</version>
|
<version>${jackson-databind-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>${jackson-databind-nullable-version}</version>
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#withXml}}
|
{{#withXml}}
|
||||||
|
|
||||||
<!-- XML processing: Jackson -->
|
<!-- XML processing: Jackson -->
|
||||||
|
@ -39,7 +39,9 @@ import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
|
|||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@ -702,7 +704,9 @@ public class ApiClient {
|
|||||||
messageConverters.add(new MappingJackson2HttpMessageConverter());
|
messageConverters.add(new MappingJackson2HttpMessageConverter());
|
||||||
XmlMapper xmlMapper = new XmlMapper();
|
XmlMapper xmlMapper = new XmlMapper();
|
||||||
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
||||||
|
{{#openApiNullable}}
|
||||||
xmlMapper.registerModule(new JsonNullableModule());
|
xmlMapper.registerModule(new JsonNullableModule());
|
||||||
|
{{/openApiNullable}}
|
||||||
messageConverters.add(new MappingJackson2XmlHttpMessageConverter(xmlMapper));
|
messageConverters.add(new MappingJackson2XmlHttpMessageConverter(xmlMapper));
|
||||||
|
|
||||||
RestTemplate restTemplate = new RestTemplate(messageConverters);
|
RestTemplate restTemplate = new RestTemplate(messageConverters);
|
||||||
@ -716,7 +720,9 @@ public class ApiClient {
|
|||||||
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
|
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
|
||||||
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
||||||
mapper.registerModule(module);
|
mapper.registerModule(module);
|
||||||
|
{{#openApiNullable}}
|
||||||
mapper.registerModule(new JsonNullableModule());
|
mapper.registerModule(new JsonNullableModule());
|
||||||
|
{{/openApiNullable}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
@ -122,7 +122,9 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.10.4"
|
jackson_version = "2.10.4"
|
||||||
jackson_databind_version = "2.10.4"
|
jackson_databind_version = "2.10.4"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
spring_web_version = "5.2.5.RELEASE"
|
spring_web_version = "5.2.5.RELEASE"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.13"
|
junit_version = "4.13"
|
||||||
@ -140,7 +142,9 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#java8}}
|
{{#java8}}
|
||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
|
@ -124,7 +124,9 @@ ext {
|
|||||||
{{#usePlayWS}}
|
{{#usePlayWS}}
|
||||||
jackson_version = "2.10.4"
|
jackson_version = "2.10.4"
|
||||||
jackson_databind_version = "2.10.4"
|
jackson_databind_version = "2.10.4"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#play24}}
|
{{#play24}}
|
||||||
play_version = "2.4.11"
|
play_version = "2.4.11"
|
||||||
{{/play24}}
|
{{/play24}}
|
||||||
@ -195,7 +197,9 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.core:jackson-core:$jackson_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-annotations:$jackson_version"
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}:$jackson_version"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}:$jackson_version"
|
||||||
{{/usePlayWS}}
|
{{/usePlayWS}}
|
||||||
compile 'javax.annotation:javax.annotation-api:1.3.2'
|
compile 'javax.annotation:javax.annotation-api:1.3.2'
|
||||||
|
@ -9,7 +9,9 @@ import retrofit2.Retrofit;
|
|||||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
||||||
import retrofit2.converter.jackson.JacksonConverterFactory;
|
import retrofit2.converter.jackson.JacksonConverterFactory;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
import play.libs.Json;
|
import play.libs.Json;
|
||||||
import play.libs.ws.WSClient;
|
import play.libs.ws.WSClient;
|
||||||
@ -72,8 +74,10 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ObjectMapper mapper = Json.mapper();
|
ObjectMapper mapper = Json.mapper();
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
mapper.registerModule(jnm);
|
mapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
return new Retrofit.Builder()
|
return new Retrofit.Builder()
|
||||||
.baseUrl(basePath)
|
.baseUrl(basePath)
|
||||||
|
@ -9,7 +9,9 @@ import retrofit2.Retrofit;
|
|||||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
||||||
import retrofit2.converter.jackson.JacksonConverterFactory;
|
import retrofit2.converter.jackson.JacksonConverterFactory;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
import play.libs.Json;
|
import play.libs.Json;
|
||||||
import play.libs.ws.WSClient;
|
import play.libs.ws.WSClient;
|
||||||
@ -71,8 +73,10 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ObjectMapper mapper = Json.mapper();
|
ObjectMapper mapper = Json.mapper();
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
mapper.registerModule(jnm);
|
mapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
return new Retrofit.Builder()
|
return new Retrofit.Builder()
|
||||||
.baseUrl(basePath)
|
.baseUrl(basePath)
|
||||||
|
@ -13,7 +13,9 @@ import retrofit2.Converter;
|
|||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
||||||
import retrofit2.converter.jackson.JacksonConverterFactory;
|
import retrofit2.converter.jackson.JacksonConverterFactory;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
import play.libs.Json;
|
import play.libs.Json;
|
||||||
import play.libs.ws.WSClient;
|
import play.libs.ws.WSClient;
|
||||||
@ -91,8 +93,10 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
if (defaultMapper == null) {
|
if (defaultMapper == null) {
|
||||||
defaultMapper = Json.mapper();
|
defaultMapper = Json.mapper();
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
defaultMapper.registerModule(jnm);
|
defaultMapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Retrofit.Builder()
|
return new Retrofit.Builder()
|
||||||
|
@ -342,11 +342,13 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson-version}</version>
|
<version>${jackson-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>${jackson-databind-nullable-version}</version>
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
<artifactId>jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}</artifactId>
|
<artifactId>jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}</artifactId>
|
||||||
@ -428,7 +430,9 @@
|
|||||||
{{#play26}}
|
{{#play26}}
|
||||||
<play-version>2.6.7</play-version>
|
<play-version>2.6.7</play-version>
|
||||||
{{/play26}}
|
{{/play26}}
|
||||||
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
|
{{/openApiNullable}}
|
||||||
{{/usePlayWS}}
|
{{/usePlayWS}}
|
||||||
<retrofit-version>2.5.0</retrofit-version>
|
<retrofit-version>2.5.0</retrofit-version>
|
||||||
{{#useRxJava}}
|
{{#useRxJava}}
|
||||||
|
@ -15,7 +15,9 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
import io.vertx.core.*;
|
import io.vertx.core.*;
|
||||||
import io.vertx.core.buffer.Buffer;
|
import io.vertx.core.buffer.Buffer;
|
||||||
import io.vertx.core.file.AsyncFile;
|
import io.vertx.core.file.AsyncFile;
|
||||||
@ -81,8 +83,10 @@ public class ApiClient {
|
|||||||
this.objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
this.objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
this.objectMapper.registerModule(new JavaTimeModule());
|
this.objectMapper.registerModule(new JavaTimeModule());
|
||||||
this.objectMapper.setDateFormat(dateFormat);
|
this.objectMapper.setDateFormat(dateFormat);
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
this.objectMapper.registerModule(jnm);
|
this.objectMapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
this.authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
|
this.authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
|
||||||
|
@ -32,7 +32,12 @@ ext {
|
|||||||
jackson_databind_version = "2.10.4"
|
jackson_databind_version = "2.10.4"
|
||||||
vertx_version = "3.4.2"
|
vertx_version = "3.4.2"
|
||||||
junit_version = "4.13"
|
junit_version = "4.13"
|
||||||
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
{{/openApiNullable}}
|
||||||
|
{{#threetenbp}}
|
||||||
|
jackson_threeten_version = "2.9.10"
|
||||||
|
{{/threetenbp}}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -50,9 +55,11 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version"
|
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:jackson_threeten_version"
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
{{/openApiNullable}}
|
||||||
compile 'javax.annotation:javax.annotation-api:1.3.2'
|
compile 'javax.annotation:javax.annotation-api:1.3.2'
|
||||||
testCompile "junit:junit:$junit_version"
|
testCompile "junit:junit:$junit_version"
|
||||||
testCompile "io.vertx:vertx-unit:$vertx_version"
|
testCompile "io.vertx:vertx-unit:$vertx_version"
|
||||||
|
@ -257,11 +257,13 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson-databind}</version>
|
<version>${jackson-databind}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>${jackson-databind-nullable-version}</version>
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
@ -3,7 +3,9 @@ package {{invokerPackage}};
|
|||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
@ -98,8 +100,10 @@ public class ApiClient {
|
|||||||
mapper.setDateFormat(dateFormat);
|
mapper.setDateFormat(dateFormat);
|
||||||
mapper.registerModule(new JavaTimeModule());
|
mapper.registerModule(new JavaTimeModule());
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
{{#openApiNullable}}
|
||||||
JsonNullableModule jnm = new JsonNullableModule();
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
mapper.registerModule(jnm);
|
mapper.registerModule(jnm);
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
this.webClient = buildWebClient(mapper);
|
this.webClient = buildWebClient(mapper);
|
||||||
this.init();
|
this.init();
|
||||||
|
@ -105,11 +105,13 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson-databind-version}</version>
|
<version>${jackson-databind-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>${jackson-databind-nullable-version}</version>
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
{{#java8}}
|
{{#java8}}
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package {{basePackage}};
|
package {{basePackage}};
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.Module;
|
import com.fasterxml.jackson.databind.Module;
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.boot.ExitCodeGenerator;
|
import org.springframework.boot.ExitCodeGenerator;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
@ -71,9 +73,11 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{#openApiNullable}}
|
||||||
@Bean
|
@Bean
|
||||||
public Module jsonNullableModule() {
|
public Module jsonNullableModule() {
|
||||||
return new JsonNullableModule();
|
return new JsonNullableModule();
|
||||||
}
|
}
|
||||||
|
{{/openApiNullable}}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -148,11 +148,13 @@
|
|||||||
<version>2.8.4</version>
|
<version>2.8.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>0.2.1</version>
|
<version>0.2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#useBeanValidation}}
|
{{#useBeanValidation}}
|
||||||
<!-- Bean Validation API support -->
|
<!-- Bean Validation API support -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -93,13 +93,15 @@
|
|||||||
{{/parentOverridden}}
|
{{/parentOverridden}}
|
||||||
</dependency>
|
</dependency>
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
{{^parentOverridden}}
|
{{^parentOverridden}}
|
||||||
<version>0.1.0</version>
|
<version>0.1.0</version>
|
||||||
{{/parentOverridden}}
|
{{/parentOverridden}}
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
@ -5,7 +5,9 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
|||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
|
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
{{/openApiNullable}}
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
@ -95,7 +97,8 @@ public class OpenAPIUiConfiguration extends WebMvcConfigurerAdapter {
|
|||||||
return new Jackson2ObjectMapperBuilder()
|
return new Jackson2ObjectMapperBuilder()
|
||||||
.indentOutput(true)
|
.indentOutput(true)
|
||||||
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||||
.modulesToInstall({{#threetenbp}}module, {{/threetenbp}}new JsonNullableModule())
|
{{#openApiNullable}}.modulesToInstall({{#threetenbp}}module, {{/threetenbp}}new JsonNullableModule()){{/openApiNullable}}
|
||||||
|
{{^openApiNullable}}{{#threetenbp}}.modulesToInstall(module){{/threetenbp}}{{/openApiNullable}}
|
||||||
.dateFormat(new RFC3339DateFormat());
|
.dateFormat(new RFC3339DateFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,11 +218,13 @@
|
|||||||
<version>${jackson-threetenbp-version}</version>
|
<version>${jackson-threetenbp-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
{{#openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jackson-databind-nullable</artifactId>
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
<version>0.1.0</version>
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
{{/openApiNullable}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
@ -267,5 +269,8 @@
|
|||||||
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
|
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
|
||||||
{{/useBeanValidation}}
|
{{/useBeanValidation}}
|
||||||
<spring-version>4.3.20.RELEASE</spring-version>
|
<spring-version>4.3.20.RELEASE</spring-version>
|
||||||
|
{{#openApiNullable}}
|
||||||
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
|
{{/openApiNullable}}
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -3,7 +3,9 @@ package {{package}};
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
{{#imports}}import {{import}};
|
{{#imports}}import {{import}};
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
|
{{#openApiNullable}}
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
|
{{/openApiNullable}}
|
||||||
{{#serializableModel}}
|
{{#serializableModel}}
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
{{/serializableModel}}
|
{{/serializableModel}}
|
||||||
|
@ -1 +1 @@
|
|||||||
{{#isNullable}}JsonNullable<{{{datatypeWithEnum}}}>{{/isNullable}}{{^isNullable}}{{{datatypeWithEnum}}}{{/isNullable}}
|
{{#openApiNullable}}{{#isNullable}}JsonNullable<{{{datatypeWithEnum}}}>{{/isNullable}}{{^isNullable}}{{{datatypeWithEnum}}}{{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}{{{datatypeWithEnum}}}{{/openApiNullable}}
|
@ -28,7 +28,12 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}
|
|||||||
{{/gson}}
|
{{/gson}}
|
||||||
{{#isContainer}}
|
{{#isContainer}}
|
||||||
{{#useBeanValidation}}@Valid{{/useBeanValidation}}
|
{{#useBeanValidation}}@Valid{{/useBeanValidation}}
|
||||||
|
{{#openApiNullable}}
|
||||||
private {{>nullableDataType}} {{name}} = {{#isNullable}}JsonNullable.undefined(){{/isNullable}}{{^isNullable}}{{#required}}{{{defaultValue}}}{{/required}}{{^required}}null{{/required}}{{/isNullable}};
|
private {{>nullableDataType}} {{name}} = {{#isNullable}}JsonNullable.undefined(){{/isNullable}}{{^isNullable}}{{#required}}{{{defaultValue}}}{{/required}}{{^required}}null{{/required}}{{/isNullable}};
|
||||||
|
{{/openApiNullable}}
|
||||||
|
{{^openApiNullable}}
|
||||||
|
private {{>nullableDataType}} {{name}} = {{#required}}{{{defaultValue}}}{{/required}}{{^required}}null{{/required}};
|
||||||
|
{{/openApiNullable}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
{{^isContainer}}
|
{{^isContainer}}
|
||||||
{{#isDate}}
|
{{#isDate}}
|
||||||
@ -37,24 +42,42 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}
|
|||||||
{{#isDateTime}}
|
{{#isDateTime}}
|
||||||
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
|
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
|
||||||
{{/isDateTime}}
|
{{/isDateTime}}
|
||||||
|
{{#openApiNullable}}
|
||||||
private {{>nullableDataType}} {{name}}{{#isNullable}} = JsonNullable.undefined(){{/isNullable}}{{^isNullable}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isNullable}};
|
private {{>nullableDataType}} {{name}}{{#isNullable}} = JsonNullable.undefined(){{/isNullable}}{{^isNullable}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isNullable}};
|
||||||
|
{{/openApiNullable}}
|
||||||
|
{{^openApiNullable}}
|
||||||
|
private {{>nullableDataType}} {{name}}{{#isNullable}} = null{{/isNullable}}{{^isNullable}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isNullable}};
|
||||||
|
{{/openApiNullable}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
|
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
|
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
|
||||||
|
{{#openApiNullable}}
|
||||||
this.{{name}} = {{#isNullable}}JsonNullable.of({{name}}){{/isNullable}}{{^isNullable}}{{name}}{{/isNullable}};
|
this.{{name}} = {{#isNullable}}JsonNullable.of({{name}}){{/isNullable}}{{^isNullable}}{{name}}{{/isNullable}};
|
||||||
|
{{/openApiNullable}}
|
||||||
|
{{^openApiNullable}}
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
{{/openApiNullable}}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
{{#isListContainer}}
|
{{#isListContainer}}
|
||||||
|
|
||||||
public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
|
public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
|
||||||
|
{{#openApiNullable}}
|
||||||
{{^required}}
|
{{^required}}
|
||||||
if (this.{{name}} == null{{#isNullable}} || !this.{{name}}.isPresent(){{/isNullable}}) {
|
if (this.{{name}} == null{{#isNullable}} || !this.{{name}}.isPresent(){{/isNullable}}) {
|
||||||
this.{{name}} = {{#isNullable}}JsonNullable.of({{{defaultValue}}}){{/isNullable}}{{^isNullable}}{{{defaultValue}}}{{/isNullable}};
|
this.{{name}} = {{#isNullable}}JsonNullable.of({{{defaultValue}}}){{/isNullable}}{{^isNullable}}{{{defaultValue}}}{{/isNullable}};
|
||||||
}
|
}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
this.{{name}}{{#isNullable}}.get(){{/isNullable}}.add({{name}}Item);
|
this.{{name}}{{#isNullable}}.get(){{/isNullable}}.add({{name}}Item);
|
||||||
|
{{/openApiNullable}}
|
||||||
|
{{^openApiNullable}}
|
||||||
|
if (this.{{name}} == null) {
|
||||||
|
this.{{name}} = {{{defaultValue}}};
|
||||||
|
}
|
||||||
|
this.{{name}}.add({{name}}Item);
|
||||||
|
{{/openApiNullable}}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
{{/isListContainer}}
|
{{/isListContainer}}
|
||||||
|
@ -262,6 +262,7 @@ public class JavaJAXRSCXFExtServerCodegenTest extends JavaJaxrsBaseTest {
|
|||||||
additionalProperties.put(AbstractJavaCodegen.SUPPORT_ASYNC, "true");
|
additionalProperties.put(AbstractJavaCodegen.SUPPORT_ASYNC, "true");
|
||||||
additionalProperties.put(AbstractJavaCodegen.SUPPORT_JAVA6, "false");
|
additionalProperties.put(AbstractJavaCodegen.SUPPORT_JAVA6, "false");
|
||||||
additionalProperties.put(AbstractJavaCodegen.WITH_XML, "true");
|
additionalProperties.put(AbstractJavaCodegen.WITH_XML, "true");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.OPENAPI_NULLABLE, "false");
|
||||||
// Options processed by AbstractJavaJAXRSServerCodegen
|
// Options processed by AbstractJavaJAXRSServerCodegen
|
||||||
additionalProperties.put(CodegenConstants.IMPL_FOLDER, "myimpl");
|
additionalProperties.put(CodegenConstants.IMPL_FOLDER, "myimpl");
|
||||||
additionalProperties.put(BeanValidationFeatures.USE_BEANVALIDATION, "true");
|
additionalProperties.put(BeanValidationFeatures.USE_BEANVALIDATION, "true");
|
||||||
@ -336,6 +337,7 @@ public class JavaJAXRSCXFExtServerCodegenTest extends JavaJaxrsBaseTest {
|
|||||||
assertEquals(testerCodegen.isJava8Mode(), true);
|
assertEquals(testerCodegen.isJava8Mode(), true);
|
||||||
assertEquals(testerCodegen.isSupportAsync(), true);
|
assertEquals(testerCodegen.isSupportAsync(), true);
|
||||||
assertEquals(testerCodegen.isWithXml(), true);
|
assertEquals(testerCodegen.isWithXml(), true);
|
||||||
|
assertEquals(testerCodegen.isOpenApiNullable(), false);
|
||||||
// Options processed by AbstractJavaJAXRSServerCodegen
|
// Options processed by AbstractJavaJAXRSServerCodegen
|
||||||
assertEquals(testerCodegen.getImplFolder(), "myimpl");
|
assertEquals(testerCodegen.getImplFolder(), "myimpl");
|
||||||
assertEquals(testerCodegen.isUseBeanValidation(), true);
|
assertEquals(testerCodegen.isUseBeanValidation(), true);
|
||||||
@ -588,6 +590,7 @@ public class JavaJAXRSCXFExtServerCodegenTest extends JavaJaxrsBaseTest {
|
|||||||
assertNull(additionalProperties.get(AbstractJavaCodegen.SUPPORT_ASYNC));
|
assertNull(additionalProperties.get(AbstractJavaCodegen.SUPPORT_ASYNC));
|
||||||
assertEquals(additionalProperties.get(AbstractJavaCodegen.SUPPORT_JAVA6), Boolean.FALSE);
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.SUPPORT_JAVA6), Boolean.FALSE);
|
||||||
assertEquals(additionalProperties.get(AbstractJavaCodegen.WITH_XML), false);
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.WITH_XML), false);
|
||||||
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.OPENAPI_NULLABLE), true);
|
||||||
// Options processed by AbstractJavaJAXRSServerCodegen
|
// Options processed by AbstractJavaJAXRSServerCodegen
|
||||||
assertNull(additionalProperties.get(CodegenConstants.IMPL_FOLDER));
|
assertNull(additionalProperties.get(CodegenConstants.IMPL_FOLDER));
|
||||||
assertEquals(additionalProperties.get(BeanValidationFeatures.USE_BEANVALIDATION), Boolean.TRUE);
|
assertEquals(additionalProperties.get(BeanValidationFeatures.USE_BEANVALIDATION), Boolean.TRUE);
|
||||||
|
21
samples/client/petstore/java/feign-no-nullable/.gitignore
vendored
Normal file
21
samples/client/petstore/java/feign-no-nullable/.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
*.class
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# exclude jar for gradle wrapper
|
||||||
|
!gradle/wrapper/*.jar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
# build files
|
||||||
|
**/target
|
||||||
|
target
|
||||||
|
.gradle
|
||||||
|
build
|
@ -0,0 +1,23 @@
|
|||||||
|
# OpenAPI Generator Ignore
|
||||||
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
@ -0,0 +1,80 @@
|
|||||||
|
.gitignore
|
||||||
|
.travis.yml
|
||||||
|
README.md
|
||||||
|
api/openapi.yaml
|
||||||
|
build.gradle
|
||||||
|
build.sbt
|
||||||
|
git_push.sh
|
||||||
|
gradle.properties
|
||||||
|
gradle/wrapper/gradle-wrapper.jar
|
||||||
|
gradle/wrapper/gradle-wrapper.properties
|
||||||
|
gradlew
|
||||||
|
gradlew.bat
|
||||||
|
pom.xml
|
||||||
|
settings.gradle
|
||||||
|
src/main/AndroidManifest.xml
|
||||||
|
src/main/java/org/openapitools/client/ApiClient.java
|
||||||
|
src/main/java/org/openapitools/client/CustomInstantDeserializer.java
|
||||||
|
src/main/java/org/openapitools/client/EncodingUtils.java
|
||||||
|
src/main/java/org/openapitools/client/ParamExpander.java
|
||||||
|
src/main/java/org/openapitools/client/RFC3339DateFormat.java
|
||||||
|
src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||||
|
src/main/java/org/openapitools/client/ServerVariable.java
|
||||||
|
src/main/java/org/openapitools/client/StringUtil.java
|
||||||
|
src/main/java/org/openapitools/client/api/AnotherFakeApi.java
|
||||||
|
src/main/java/org/openapitools/client/api/FakeApi.java
|
||||||
|
src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java
|
||||||
|
src/main/java/org/openapitools/client/api/PetApi.java
|
||||||
|
src/main/java/org/openapitools/client/api/StoreApi.java
|
||||||
|
src/main/java/org/openapitools/client/api/UserApi.java
|
||||||
|
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
|
||||||
|
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
|
||||||
|
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
|
||||||
|
src/main/java/org/openapitools/client/auth/OAuth.java
|
||||||
|
src/main/java/org/openapitools/client/auth/OAuthFlow.java
|
||||||
|
src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java
|
||||||
|
src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java
|
||||||
|
src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java
|
||||||
|
src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java
|
||||||
|
src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java
|
||||||
|
src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java
|
||||||
|
src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java
|
||||||
|
src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java
|
||||||
|
src/main/java/org/openapitools/client/model/Animal.java
|
||||||
|
src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java
|
||||||
|
src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java
|
||||||
|
src/main/java/org/openapitools/client/model/ArrayTest.java
|
||||||
|
src/main/java/org/openapitools/client/model/BigCat.java
|
||||||
|
src/main/java/org/openapitools/client/model/BigCatAllOf.java
|
||||||
|
src/main/java/org/openapitools/client/model/Capitalization.java
|
||||||
|
src/main/java/org/openapitools/client/model/Cat.java
|
||||||
|
src/main/java/org/openapitools/client/model/CatAllOf.java
|
||||||
|
src/main/java/org/openapitools/client/model/Category.java
|
||||||
|
src/main/java/org/openapitools/client/model/ClassModel.java
|
||||||
|
src/main/java/org/openapitools/client/model/Client.java
|
||||||
|
src/main/java/org/openapitools/client/model/Dog.java
|
||||||
|
src/main/java/org/openapitools/client/model/DogAllOf.java
|
||||||
|
src/main/java/org/openapitools/client/model/EnumArrays.java
|
||||||
|
src/main/java/org/openapitools/client/model/EnumClass.java
|
||||||
|
src/main/java/org/openapitools/client/model/EnumTest.java
|
||||||
|
src/main/java/org/openapitools/client/model/FileSchemaTestClass.java
|
||||||
|
src/main/java/org/openapitools/client/model/FormatTest.java
|
||||||
|
src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java
|
||||||
|
src/main/java/org/openapitools/client/model/MapTest.java
|
||||||
|
src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java
|
||||||
|
src/main/java/org/openapitools/client/model/Model200Response.java
|
||||||
|
src/main/java/org/openapitools/client/model/ModelApiResponse.java
|
||||||
|
src/main/java/org/openapitools/client/model/ModelReturn.java
|
||||||
|
src/main/java/org/openapitools/client/model/Name.java
|
||||||
|
src/main/java/org/openapitools/client/model/NumberOnly.java
|
||||||
|
src/main/java/org/openapitools/client/model/Order.java
|
||||||
|
src/main/java/org/openapitools/client/model/OuterComposite.java
|
||||||
|
src/main/java/org/openapitools/client/model/OuterEnum.java
|
||||||
|
src/main/java/org/openapitools/client/model/Pet.java
|
||||||
|
src/main/java/org/openapitools/client/model/ReadOnlyFirst.java
|
||||||
|
src/main/java/org/openapitools/client/model/SpecialModelName.java
|
||||||
|
src/main/java/org/openapitools/client/model/Tag.java
|
||||||
|
src/main/java/org/openapitools/client/model/TypeHolderDefault.java
|
||||||
|
src/main/java/org/openapitools/client/model/TypeHolderExample.java
|
||||||
|
src/main/java/org/openapitools/client/model/User.java
|
||||||
|
src/main/java/org/openapitools/client/model/XmlItem.java
|
@ -0,0 +1 @@
|
|||||||
|
5.0.0-SNAPSHOT
|
22
samples/client/petstore/java/feign-no-nullable/.travis.yml
Normal file
22
samples/client/petstore/java/feign-no-nullable/.travis.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# Generated by OpenAPI Generator: https://openapi-generator.tech
|
||||||
|
#
|
||||||
|
# Ref: https://docs.travis-ci.com/user/languages/java/
|
||||||
|
#
|
||||||
|
language: java
|
||||||
|
jdk:
|
||||||
|
- openjdk12
|
||||||
|
- openjdk11
|
||||||
|
- openjdk10
|
||||||
|
- openjdk9
|
||||||
|
- openjdk8
|
||||||
|
before_install:
|
||||||
|
# ensure gradlew has proper permission
|
||||||
|
- chmod a+x ./gradlew
|
||||||
|
script:
|
||||||
|
# test using maven
|
||||||
|
#- mvn test
|
||||||
|
# test using gradle
|
||||||
|
- gradle test
|
||||||
|
# test using sbt
|
||||||
|
# - sbt test
|
43
samples/client/petstore/java/feign-no-nullable/README.md
Normal file
43
samples/client/petstore/java/feign-no-nullable/README.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# petstore-feign-no-nullable
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||||
|
|
||||||
|
## Installation & Usage
|
||||||
|
|
||||||
|
To install the API client library to your local Maven repository, simply execute:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn install
|
||||||
|
```
|
||||||
|
|
||||||
|
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||||
|
|
||||||
|
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>petstore-feign-no-nullable</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
2190
samples/client/petstore/java/feign-no-nullable/api/openapi.yaml
Normal file
2190
samples/client/petstore/java/feign-no-nullable/api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
123
samples/client/petstore/java/feign-no-nullable/build.gradle
Normal file
123
samples/client/petstore/java/feign-no-nullable/build.gradle
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
|
group = 'org.openapitools'
|
||||||
|
version = '1.0.0'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||||
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(hasProperty('target') && target == 'android') {
|
||||||
|
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion '25.0.2'
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 14
|
||||||
|
targetSdkVersion 25
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_7
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename the aar correctly
|
||||||
|
libraryVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
def outputFile = output.outputFile
|
||||||
|
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||||
|
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||||
|
output.outputFile = new File(outputFile.parent, fileName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
provided 'javax.annotation:jsr250-api:1.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
android.libraryVariants.all { variant ->
|
||||||
|
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||||
|
task.description = "Create jar artifact for ${variant.name}"
|
||||||
|
task.dependsOn variant.javaCompile
|
||||||
|
task.from variant.javaCompile.destinationDir
|
||||||
|
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||||
|
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||||
|
artifacts.add('archives', task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
from android.sourceSets.main.java.srcDirs
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_7
|
||||||
|
|
||||||
|
install {
|
||||||
|
repositories.mavenInstaller {
|
||||||
|
pom.artifactId = 'petstore-feign-no-nullable'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task execute(type:JavaExec) {
|
||||||
|
main = System.getProperty('mainClass')
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
swagger_annotations_version = "1.5.24"
|
||||||
|
jackson_version = "2.10.3"
|
||||||
|
jackson_databind_version = "2.10.3"
|
||||||
|
jackson_threetenbp_version = "2.9.10"
|
||||||
|
feign_version = "10.11"
|
||||||
|
feign_form_version = "3.8.0"
|
||||||
|
junit_version = "4.13"
|
||||||
|
oltu_version = "1.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||||
|
compile "com.google.code.findbugs:jsr305:3.0.2"
|
||||||
|
compile "io.github.openfeign:feign-core:$feign_version"
|
||||||
|
compile "io.github.openfeign:feign-jackson:$feign_version"
|
||||||
|
compile "io.github.openfeign:feign-slf4j:$feign_version"
|
||||||
|
compile "io.github.openfeign.form:feign-form:$feign_form_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 "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version"
|
||||||
|
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"
|
||||||
|
compile "com.brsanthu:migbase64:2.2"
|
||||||
|
compile 'javax.annotation:javax.annotation-api:1.3.2'
|
||||||
|
testCompile "junit:junit:$junit_version"
|
||||||
|
}
|
28
samples/client/petstore/java/feign-no-nullable/build.sbt
Normal file
28
samples/client/petstore/java/feign-no-nullable/build.sbt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
lazy val root = (project in file(".")).
|
||||||
|
settings(
|
||||||
|
organization := "org.openapitools",
|
||||||
|
name := "petstore-feign-no-nullable",
|
||||||
|
version := "1.0.0",
|
||||||
|
scalaVersion := "2.11.4",
|
||||||
|
scalacOptions ++= Seq("-feature"),
|
||||||
|
javacOptions in compile ++= Seq("-Xlint:deprecation"),
|
||||||
|
publishArtifact in (Compile, packageDoc) := false,
|
||||||
|
resolvers += Resolver.mavenLocal,
|
||||||
|
libraryDependencies ++= Seq(
|
||||||
|
"io.swagger" % "swagger-annotations" % "1.5.24" % "compile",
|
||||||
|
"io.github.openfeign" % "feign-core" % "10.11" % "compile",
|
||||||
|
"io.github.openfeign" % "feign-jackson" % "10.11" % "compile",
|
||||||
|
"io.github.openfeign" % "feign-slf4j" % "10.11" % "compile",
|
||||||
|
"io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile",
|
||||||
|
"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.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile",
|
||||||
|
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
|
||||||
|
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
|
||||||
|
"com.brsanthu" % "migbase64" % "2.2" % "compile",
|
||||||
|
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
|
||||||
|
"junit" % "junit" % "4.13" % "test",
|
||||||
|
"com.novocode" % "junit-interface" % "0.10" % "test"
|
||||||
|
)
|
||||||
|
)
|
58
samples/client/petstore/java/feign-no-nullable/git_push.sh
Normal file
58
samples/client/petstore/java/feign-no-nullable/git_push.sh
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id="GIT_USER_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id="GIT_REPO_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note="Minor update"
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
git_remote=`git remote`
|
||||||
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
@ -0,0 +1,2 @@
|
|||||||
|
# Uncomment to build for Android
|
||||||
|
#target = android
|
BIN
samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
samples/client/petstore/java/feign-no-nullable/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
183
samples/client/petstore/java/feign-no-nullable/gradlew
vendored
Normal file
183
samples/client/petstore/java/feign-no-nullable/gradlew
vendored
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
100
samples/client/petstore/java/feign-no-nullable/gradlew.bat
vendored
Normal file
100
samples/client/petstore/java/feign-no-nullable/gradlew.bat
vendored
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
313
samples/client/petstore/java/feign-no-nullable/pom.xml
Normal file
313
samples/client/petstore/java/feign-no-nullable/pom.xml
Normal file
@ -0,0 +1,313 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>petstore-feign-no-nullable</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>petstore-feign-no-nullable</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<url>https://github.com/openapitools/openapi-generator</url>
|
||||||
|
<description>OpenAPI Java</description>
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
|
||||||
|
<url>https://github.com/openapitools/openapi-generator</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>Unlicense</name>
|
||||||
|
<url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>OpenAPI-Generator Contributors</name>
|
||||||
|
<email>team@openapitools.org</email>
|
||||||
|
<organization>OpenAPITools.org</organization>
|
||||||
|
<organizationUrl>http://openapitools.org</organizationUrl>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-enforcer-plugin</artifactId>
|
||||||
|
<version>3.0.0-M1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>enforce-maven</id>
|
||||||
|
<goals>
|
||||||
|
<goal>enforce</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<rules>
|
||||||
|
<requireMavenVersion>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
</requireMavenVersion>
|
||||||
|
</rules>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.0.0-M4</version>
|
||||||
|
<configuration>
|
||||||
|
<systemProperties>
|
||||||
|
<property>
|
||||||
|
<name>loggerPath</name>
|
||||||
|
<value>conf/log4j.properties</value>
|
||||||
|
</property>
|
||||||
|
</systemProperties>
|
||||||
|
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||||
|
<parallel>methods</parallel>
|
||||||
|
<threadCount>10</threadCount>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- attach test jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>1.10</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add_sources</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/main/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>add_test_sources</id>
|
||||||
|
<phase>generate-test-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-test-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/test/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<fork>true</fork>
|
||||||
|
<meminitial>128m</meminitial>
|
||||||
|
<maxmem>512m</maxmem>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>-Xlint:all</arg>
|
||||||
|
<arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. -->
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<configuration>
|
||||||
|
<doclint>none</doclint>
|
||||||
|
<source>1.7</source>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>2.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>1.5</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>${swagger-annotations-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- @Nullable annotation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- HTTP client: Netflix Feign -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.openfeign</groupId>
|
||||||
|
<artifactId>feign-core</artifactId>
|
||||||
|
<version>${feign-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.openfeign</groupId>
|
||||||
|
<artifactId>feign-jackson</artifactId>
|
||||||
|
<version>${feign-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.openfeign</groupId>
|
||||||
|
<artifactId>feign-slf4j</artifactId>
|
||||||
|
<version>${feign-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.openfeign.form</groupId>
|
||||||
|
<artifactId>feign-form</artifactId>
|
||||||
|
<version>${feign-form-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON processing: jackson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>${jackson-databind-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.joschi.jackson</groupId>
|
||||||
|
<artifactId>jackson-datatype-threetenbp</artifactId>
|
||||||
|
<version>${jackson-threetenbp-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.oltu.oauth2</groupId>
|
||||||
|
<artifactId>org.apache.oltu.oauth2.client</artifactId>
|
||||||
|
<version>${oltu-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.annotation</groupId>
|
||||||
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
|
<version>${javax-annotation-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- test dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>mockwebserver</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<java.version>1.7</java.version>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<swagger-annotations-version>1.5.24</swagger-annotations-version>
|
||||||
|
<feign-version>10.11</feign-version>
|
||||||
|
<feign-form-version>3.8.0</feign-form-version>
|
||||||
|
<jackson-version>2.10.3</jackson-version>
|
||||||
|
<jackson-databind-version>2.10.3</jackson-databind-version>
|
||||||
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
|
<javax-annotation-version>1.3.2</javax-annotation-version>
|
||||||
|
<junit-version>4.13</junit-version>
|
||||||
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
|
<oltu-version>1.0.1</oltu-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "petstore-feign-no-nullable"
|
@ -0,0 +1,3 @@
|
|||||||
|
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application />
|
||||||
|
</manifest>
|
@ -0,0 +1,352 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder;
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
|
||||||
|
|
||||||
|
import org.threeten.bp.*;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
|
||||||
|
|
||||||
|
import feign.Feign;
|
||||||
|
import feign.RequestInterceptor;
|
||||||
|
import feign.form.FormEncoder;
|
||||||
|
import feign.jackson.JacksonDecoder;
|
||||||
|
import feign.jackson.JacksonEncoder;
|
||||||
|
import feign.slf4j.Slf4jLogger;
|
||||||
|
import org.openapitools.client.auth.*;
|
||||||
|
import org.openapitools.client.auth.OAuth.AccessTokenListener;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class ApiClient {
|
||||||
|
public interface Api {}
|
||||||
|
|
||||||
|
protected ObjectMapper objectMapper;
|
||||||
|
private String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
|
private Map<String, RequestInterceptor> apiAuthorizations;
|
||||||
|
private Feign.Builder feignBuilder;
|
||||||
|
|
||||||
|
public ApiClient() {
|
||||||
|
objectMapper = createObjectMapper();
|
||||||
|
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||||
|
feignBuilder = Feign.builder()
|
||||||
|
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
|
||||||
|
.decoder(new JacksonDecoder(objectMapper))
|
||||||
|
.logger(new Slf4jLogger());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient(String[] authNames) {
|
||||||
|
this();
|
||||||
|
for(String authName : authNames) {
|
||||||
|
RequestInterceptor auth;
|
||||||
|
if ("api_key".equals(authName)) {
|
||||||
|
auth = new ApiKeyAuth("header", "api_key");
|
||||||
|
} else if ("api_key_query".equals(authName)) {
|
||||||
|
auth = new ApiKeyAuth("query", "api_key_query");
|
||||||
|
} else if ("http_basic_test".equals(authName)) {
|
||||||
|
auth = new HttpBasicAuth();
|
||||||
|
} else if ("petstore_auth".equals(authName)) {
|
||||||
|
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||||
|
}
|
||||||
|
addAuthorization(authName, auth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor for single auth name
|
||||||
|
* @param authName
|
||||||
|
*/
|
||||||
|
public ApiClient(String authName) {
|
||||||
|
this(new String[]{authName});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper constructor for single api key
|
||||||
|
* @param authName
|
||||||
|
* @param apiKey
|
||||||
|
*/
|
||||||
|
public ApiClient(String authName, String apiKey) {
|
||||||
|
this(authName);
|
||||||
|
this.setApiKey(apiKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper constructor for single basic auth or password oauth2
|
||||||
|
* @param authName
|
||||||
|
* @param username
|
||||||
|
* @param password
|
||||||
|
*/
|
||||||
|
public ApiClient(String authName, String username, String password) {
|
||||||
|
this(authName);
|
||||||
|
this.setCredentials(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper constructor for single password oauth2
|
||||||
|
* @param authName
|
||||||
|
* @param clientId
|
||||||
|
* @param secret
|
||||||
|
* @param username
|
||||||
|
* @param password
|
||||||
|
*/
|
||||||
|
public ApiClient(String authName, String clientId, String secret, String username, String password) {
|
||||||
|
this(authName);
|
||||||
|
this.getTokenEndPoint()
|
||||||
|
.setClientId(clientId)
|
||||||
|
.setClientSecret(secret)
|
||||||
|
.setUsername(username)
|
||||||
|
.setPassword(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBasePath() {
|
||||||
|
return basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setBasePath(String basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, RequestInterceptor> getApiAuthorizations() {
|
||||||
|
return apiAuthorizations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiAuthorizations(Map<String, RequestInterceptor> apiAuthorizations) {
|
||||||
|
this.apiAuthorizations = apiAuthorizations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Feign.Builder getFeignBuilder() {
|
||||||
|
return feignBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient setFeignBuilder(Feign.Builder feignBuilder) {
|
||||||
|
this.feignBuilder = feignBuilder;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObjectMapper createObjectMapper() {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
|
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
|
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||||
|
objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE);
|
||||||
|
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
objectMapper.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);
|
||||||
|
objectMapper.registerModule(module);
|
||||||
|
return objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectMapper getObjectMapper(){
|
||||||
|
return objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a feign client for given API interface.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* ApiClient apiClient = new ApiClient();
|
||||||
|
* apiClient.setBasePath("http://localhost:8080");
|
||||||
|
* XYZApi api = apiClient.buildClient(XYZApi.class);
|
||||||
|
* XYZResponse response = api.someMethod(...);
|
||||||
|
* @param <T> Type
|
||||||
|
* @param clientClass Client class
|
||||||
|
* @return The Client
|
||||||
|
*/
|
||||||
|
public <T extends Api> T buildClient(Class<T> clientClass) {
|
||||||
|
return feignBuilder.target(clientClass, basePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json";
|
||||||
|
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";
|
||||||
|
if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json";
|
||||||
|
return contentTypes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to configure the bearer token.
|
||||||
|
* @param bearerToken the bearer token.
|
||||||
|
*/
|
||||||
|
public void setBearerToken(String bearerToken) {
|
||||||
|
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||||
|
if (apiAuthorization instanceof HttpBearerAuth) {
|
||||||
|
((HttpBearerAuth) apiAuthorization).setBearerToken(bearerToken);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("No Bearer authentication configured!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to configure the first api key found
|
||||||
|
* @param apiKey API key
|
||||||
|
*/
|
||||||
|
public void setApiKey(String apiKey) {
|
||||||
|
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||||
|
if (apiAuthorization instanceof ApiKeyAuth) {
|
||||||
|
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
|
||||||
|
keyAuth.setApiKey(apiKey);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("No API key authentication configured!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to configure the username/password for basic auth or password OAuth
|
||||||
|
* @param username Username
|
||||||
|
* @param password Password
|
||||||
|
*/
|
||||||
|
public void setCredentials(String username, String password) {
|
||||||
|
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||||
|
if (apiAuthorization instanceof HttpBasicAuth) {
|
||||||
|
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
|
||||||
|
basicAuth.setCredentials(username, password);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (apiAuthorization instanceof OAuth) {
|
||||||
|
OAuth oauth = (OAuth) apiAuthorization;
|
||||||
|
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("No Basic authentication or OAuth configured!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||||
|
if (apiAuthorization instanceof OAuth) {
|
||||||
|
OAuth oauth = (OAuth) apiAuthorization;
|
||||||
|
return oauth.getTokenRequestBuilder();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
|
||||||
|
* @return Authentication request builder
|
||||||
|
*/
|
||||||
|
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
|
||||||
|
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||||
|
if (apiAuthorization instanceof OAuth) {
|
||||||
|
OAuth oauth = (OAuth) apiAuthorization;
|
||||||
|
return oauth.getAuthenticationRequestBuilder();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
|
||||||
|
* @param accessToken Access Token
|
||||||
|
* @param expiresIn Validity period in seconds
|
||||||
|
*/
|
||||||
|
public void setAccessToken(String accessToken, Long expiresIn) {
|
||||||
|
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||||
|
if (apiAuthorization instanceof OAuth) {
|
||||||
|
OAuth oauth = (OAuth) apiAuthorization;
|
||||||
|
oauth.setAccessToken(accessToken, expiresIn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to configure the oauth accessCode/implicit flow parameters
|
||||||
|
* @param clientId Client ID
|
||||||
|
* @param clientSecret Client secret
|
||||||
|
* @param redirectURI Redirect URI
|
||||||
|
*/
|
||||||
|
public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
|
||||||
|
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||||
|
if (apiAuthorization instanceof OAuth) {
|
||||||
|
OAuth oauth = (OAuth) apiAuthorization;
|
||||||
|
oauth.getTokenRequestBuilder()
|
||||||
|
.setClientId(clientId)
|
||||||
|
.setClientSecret(clientSecret)
|
||||||
|
.setRedirectURI(redirectURI);
|
||||||
|
oauth.getAuthenticationRequestBuilder()
|
||||||
|
.setClientId(clientId)
|
||||||
|
.setRedirectURI(redirectURI);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures a listener which is notified when a new access token is received.
|
||||||
|
* @param accessTokenListener Acesss token listener
|
||||||
|
*/
|
||||||
|
public void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
|
||||||
|
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||||
|
if (apiAuthorization instanceof OAuth) {
|
||||||
|
OAuth oauth = (OAuth) apiAuthorization;
|
||||||
|
oauth.registerAccessTokenListener(accessTokenListener);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets request interceptor based on authentication name
|
||||||
|
* @param authName Authentiation name
|
||||||
|
* @return Request Interceptor
|
||||||
|
*/
|
||||||
|
public RequestInterceptor getAuthorization(String authName) {
|
||||||
|
return apiAuthorizations.get(authName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an authorization to be used by the client
|
||||||
|
* @param authName Authentication name
|
||||||
|
* @param authorization Request interceptor
|
||||||
|
*/
|
||||||
|
public void addAuthorization(String authName, RequestInterceptor authorization) {
|
||||||
|
if (apiAuthorizations.containsKey(authName)) {
|
||||||
|
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
|
||||||
|
}
|
||||||
|
apiAuthorizations.put(authName, authorization);
|
||||||
|
feignBuilder.requestInterceptor(authorization);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,232 @@
|
|||||||
|
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<T extends Temporal>
|
||||||
|
extends ThreeTenDateTimeDeserializerBase<T> {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static final CustomInstantDeserializer<Instant> INSTANT = new CustomInstantDeserializer<Instant>(
|
||||||
|
Instant.class, DateTimeFormatter.ISO_INSTANT,
|
||||||
|
new Function<TemporalAccessor, Instant>() {
|
||||||
|
@Override
|
||||||
|
public Instant apply(TemporalAccessor temporalAccessor) {
|
||||||
|
return Instant.from(temporalAccessor);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Function<FromIntegerArguments, Instant>() {
|
||||||
|
@Override
|
||||||
|
public Instant apply(FromIntegerArguments a) {
|
||||||
|
return Instant.ofEpochMilli(a.value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Function<FromDecimalArguments, Instant>() {
|
||||||
|
@Override
|
||||||
|
public Instant apply(FromDecimalArguments a) {
|
||||||
|
return Instant.ofEpochSecond(a.integer, a.fraction);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new CustomInstantDeserializer<OffsetDateTime>(
|
||||||
|
OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME,
|
||||||
|
new Function<TemporalAccessor, OffsetDateTime>() {
|
||||||
|
@Override
|
||||||
|
public OffsetDateTime apply(TemporalAccessor temporalAccessor) {
|
||||||
|
return OffsetDateTime.from(temporalAccessor);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Function<FromIntegerArguments, OffsetDateTime>() {
|
||||||
|
@Override
|
||||||
|
public OffsetDateTime apply(FromIntegerArguments a) {
|
||||||
|
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Function<FromDecimalArguments, OffsetDateTime>() {
|
||||||
|
@Override
|
||||||
|
public OffsetDateTime apply(FromDecimalArguments a) {
|
||||||
|
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() {
|
||||||
|
@Override
|
||||||
|
public OffsetDateTime apply(OffsetDateTime d, ZoneId z) {
|
||||||
|
return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new CustomInstantDeserializer<ZonedDateTime>(
|
||||||
|
ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME,
|
||||||
|
new Function<TemporalAccessor, ZonedDateTime>() {
|
||||||
|
@Override
|
||||||
|
public ZonedDateTime apply(TemporalAccessor temporalAccessor) {
|
||||||
|
return ZonedDateTime.from(temporalAccessor);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Function<FromIntegerArguments, ZonedDateTime>() {
|
||||||
|
@Override
|
||||||
|
public ZonedDateTime apply(FromIntegerArguments a) {
|
||||||
|
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Function<FromDecimalArguments, ZonedDateTime>() {
|
||||||
|
@Override
|
||||||
|
public ZonedDateTime apply(FromDecimalArguments a) {
|
||||||
|
return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() {
|
||||||
|
@Override
|
||||||
|
public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) {
|
||||||
|
return zonedDateTime.withZoneSameInstant(zoneId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
protected final Function<FromIntegerArguments, T> fromMilliseconds;
|
||||||
|
|
||||||
|
protected final Function<FromDecimalArguments, T> fromNanoseconds;
|
||||||
|
|
||||||
|
protected final Function<TemporalAccessor, T> parsedToValue;
|
||||||
|
|
||||||
|
protected final BiFunction<T, ZoneId, T> adjust;
|
||||||
|
|
||||||
|
protected CustomInstantDeserializer(Class<T> supportedType,
|
||||||
|
DateTimeFormatter parser,
|
||||||
|
Function<TemporalAccessor, T> parsedToValue,
|
||||||
|
Function<FromIntegerArguments, T> fromMilliseconds,
|
||||||
|
Function<FromDecimalArguments, T> fromNanoseconds,
|
||||||
|
BiFunction<T, ZoneId, T> adjust) {
|
||||||
|
super(supportedType, parser);
|
||||||
|
this.parsedToValue = parsedToValue;
|
||||||
|
this.fromMilliseconds = fromMilliseconds;
|
||||||
|
this.fromNanoseconds = fromNanoseconds;
|
||||||
|
this.adjust = adjust == null ? new BiFunction<T, ZoneId, T>() {
|
||||||
|
@Override
|
||||||
|
public T apply(T t, ZoneId zoneId) {
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
} : adjust;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected CustomInstantDeserializer(CustomInstantDeserializer<T> base, DateTimeFormatter f) {
|
||||||
|
super((Class<T>) base.handledType(), f);
|
||||||
|
parsedToValue = base.parsedToValue;
|
||||||
|
fromMilliseconds = base.fromMilliseconds;
|
||||||
|
fromNanoseconds = base.fromNanoseconds;
|
||||||
|
adjust = base.adjust;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JsonDeserializer<T> withDateFormat(DateTimeFormatter dtf) {
|
||||||
|
if (dtf == _formatter) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return new CustomInstantDeserializer<T>(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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilities to support Swagger encoding formats in Feign.
|
||||||
|
*/
|
||||||
|
public final class EncodingUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private constructor. Do not construct this class.
|
||||||
|
*/
|
||||||
|
private EncodingUtils() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Encodes a collection of query parameters according to the Swagger
|
||||||
|
* collection format.</p>
|
||||||
|
*
|
||||||
|
* <p>Of the various collection formats defined by Swagger ("csv", "tsv",
|
||||||
|
* etc), Feign only natively supports "multi". This utility generates the
|
||||||
|
* other format types so it will be properly processed by Feign.</p>
|
||||||
|
*
|
||||||
|
* <p>Note, as part of reformatting, it URL encodes the parameters as
|
||||||
|
* well.</p>
|
||||||
|
* @param parameters The collection object to be formatted. This object will
|
||||||
|
* not be changed.
|
||||||
|
* @param collectionFormat The Swagger collection format (eg, "csv", "tsv",
|
||||||
|
* "pipes"). See the
|
||||||
|
* <a href="http://swagger.io/specification/#parameter-object-44">
|
||||||
|
* OpenAPI Spec</a> for more details.
|
||||||
|
* @return An object that will be correctly formatted by Feign.
|
||||||
|
*/
|
||||||
|
public static Object encodeCollection(Collection<?> parameters,
|
||||||
|
String collectionFormat) {
|
||||||
|
if (parameters == null) {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
List<String> stringValues = new ArrayList<>(parameters.size());
|
||||||
|
for (Object parameter : parameters) {
|
||||||
|
// ignore null values (same behavior as Feign)
|
||||||
|
if (parameter != null) {
|
||||||
|
stringValues.add(encode(parameter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Feign natively handles single-element lists and the "multi" format.
|
||||||
|
if (stringValues.size() < 2 || "multi".equals(collectionFormat)) {
|
||||||
|
return stringValues;
|
||||||
|
}
|
||||||
|
// Otherwise return a formatted String
|
||||||
|
String[] stringArray = stringValues.toArray(new String[0]);
|
||||||
|
switch (collectionFormat) {
|
||||||
|
case "csv":
|
||||||
|
default:
|
||||||
|
return StringUtil.join(stringArray, ",");
|
||||||
|
case "ssv":
|
||||||
|
return StringUtil.join(stringArray, " ");
|
||||||
|
case "tsv":
|
||||||
|
return StringUtil.join(stringArray, "\t");
|
||||||
|
case "pipes":
|
||||||
|
return StringUtil.join(stringArray, "|");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL encode a single query parameter.
|
||||||
|
* @param parameter The query parameter to encode. This object will not be
|
||||||
|
* changed.
|
||||||
|
* @return The URL encoded string representation of the parameter. If the
|
||||||
|
* parameter is null, returns null.
|
||||||
|
*/
|
||||||
|
public static String encode(Object parameter) {
|
||||||
|
if (parameter == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return URLEncoder.encode(parameter.toString(), "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
// Should never happen, UTF-8 is always supported
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import feign.Param;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Param Expander to convert {@link Date} to RFC3339
|
||||||
|
*/
|
||||||
|
public class ParamExpander implements Param.Expander {
|
||||||
|
|
||||||
|
private static final DateFormat dateformat = new RFC3339DateFormat();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String expand(Object value) {
|
||||||
|
if (value instanceof Date) {
|
||||||
|
return dateformat.format(value);
|
||||||
|
}
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.util.StdDateFormat;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.FieldPosition;
|
||||||
|
import java.text.ParsePosition;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
public class RFC3339DateFormat extends DateFormat {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
|
||||||
|
|
||||||
|
private final StdDateFormat fmt = new StdDateFormat()
|
||||||
|
.withTimeZone(TIMEZONE_Z)
|
||||||
|
.withColonInTimeZone(true);
|
||||||
|
|
||||||
|
public RFC3339DateFormat() {
|
||||||
|
this.calendar = new GregorianCalendar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date parse(String source) {
|
||||||
|
return parse(source, new ParsePosition(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date parse(String source, ParsePosition pos) {
|
||||||
|
return fmt.parse(source, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
|
||||||
|
return fmt.format(date, toAppendTo, fieldPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class StringUtil {
|
||||||
|
/**
|
||||||
|
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||||
|
*
|
||||||
|
* @param array The array
|
||||||
|
* @param value The value to search
|
||||||
|
* @return true if the array contains the value
|
||||||
|
*/
|
||||||
|
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||||
|
for (String str : array) {
|
||||||
|
if (value == null && str == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (value != null && value.equalsIgnoreCase(str)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join an array of strings with the given separator.
|
||||||
|
* <p>
|
||||||
|
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||||
|
* if one of those libraries is added as dependency.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param array The array of strings
|
||||||
|
* @param separator The separator
|
||||||
|
* @return the resulting string
|
||||||
|
*/
|
||||||
|
public static String join(String[] array, String separator) {
|
||||||
|
int len = array.length;
|
||||||
|
if (len == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
out.append(array[0]);
|
||||||
|
for (int i = 1; i < len; i++) {
|
||||||
|
out.append(separator).append(array[i]);
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join a list of strings with the given separator.
|
||||||
|
*
|
||||||
|
* @param list The list of strings
|
||||||
|
* @param separator The separator
|
||||||
|
* @return the resulting string
|
||||||
|
*/
|
||||||
|
public static String join(Collection<String> list, String separator) {
|
||||||
|
Iterator<String> iterator = list.iterator();
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
if (iterator.hasNext()) {
|
||||||
|
out.append(iterator.next());
|
||||||
|
}
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
out.append(separator).append(iterator.next());
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.EncodingUtils;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.Client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import feign.*;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public interface AnotherFakeApi extends ApiClient.Api {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test special tags
|
||||||
|
* To test special tags and operation ID starting with number
|
||||||
|
* @param body client model (required)
|
||||||
|
* @return Client
|
||||||
|
*/
|
||||||
|
@RequestLine("PATCH /another-fake/dummy")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Client call123testSpecialTags(Client body);
|
||||||
|
}
|
@ -0,0 +1,422 @@
|
|||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.EncodingUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.openapitools.client.model.Client;
|
||||||
|
import java.io.File;
|
||||||
|
import org.openapitools.client.model.FileSchemaTestClass;
|
||||||
|
import org.threeten.bp.LocalDate;
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
|
import org.openapitools.client.model.OuterComposite;
|
||||||
|
import org.openapitools.client.model.User;
|
||||||
|
import org.openapitools.client.model.XmlItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import feign.*;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public interface FakeApi extends ApiClient.Api {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates an XmlItem
|
||||||
|
* this route creates an XmlItem
|
||||||
|
* @param xmlItem XmlItem Body (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /fake/create_xml_item")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/xml",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void createXmlItem(XmlItem xmlItem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Test serialization of outer boolean types
|
||||||
|
* @param body Input boolean as post body (optional)
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /fake/outer/boolean")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: */*",
|
||||||
|
})
|
||||||
|
Boolean fakeOuterBooleanSerialize(Boolean body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Test serialization of object with outer number type
|
||||||
|
* @param body Input composite as post body (optional)
|
||||||
|
* @return OuterComposite
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /fake/outer/composite")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: */*",
|
||||||
|
})
|
||||||
|
OuterComposite fakeOuterCompositeSerialize(OuterComposite body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Test serialization of outer number types
|
||||||
|
* @param body Input number as post body (optional)
|
||||||
|
* @return BigDecimal
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /fake/outer/number")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: */*",
|
||||||
|
})
|
||||||
|
BigDecimal fakeOuterNumberSerialize(BigDecimal body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Test serialization of outer string types
|
||||||
|
* @param body Input string as post body (optional)
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /fake/outer/string")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: */*",
|
||||||
|
})
|
||||||
|
String fakeOuterStringSerialize(String body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* For this test, the body for this request much reference a schema named `File`.
|
||||||
|
* @param body (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("PUT /fake/body-with-file-schema")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void testBodyWithFileSchema(FileSchemaTestClass body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param query (required)
|
||||||
|
* @param body (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("PUT /fake/body-with-query-params?query={query}")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void testBodyWithQueryParams(@Param("query") String query, User body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Note, this is equivalent to the other <code>testBodyWithQueryParams</code> method,
|
||||||
|
* but with the query parameters collected into a single Map parameter. This
|
||||||
|
* is convenient for services with optional query parameters, especially when
|
||||||
|
* used with the {@link TestBodyWithQueryParamsQueryParams} class that allows for
|
||||||
|
* building up this map in a fluent style.
|
||||||
|
* @param body (required)
|
||||||
|
* @param queryParams Map of query parameters as name-value pairs
|
||||||
|
* <p>The following elements may be specified in the query map:</p>
|
||||||
|
* <ul>
|
||||||
|
* <li>query - (required)</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@RequestLine("PUT /fake/body-with-query-params?query={query}")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void testBodyWithQueryParams(User body, @QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience class for generating query parameters for the
|
||||||
|
* <code>testBodyWithQueryParams</code> method in a fluent style.
|
||||||
|
*/
|
||||||
|
public static class TestBodyWithQueryParamsQueryParams extends HashMap<String, Object> {
|
||||||
|
public TestBodyWithQueryParamsQueryParams query(final String value) {
|
||||||
|
put("query", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test \"client\" model
|
||||||
|
* To test \"client\" model
|
||||||
|
* @param body client model (required)
|
||||||
|
* @return Client
|
||||||
|
*/
|
||||||
|
@RequestLine("PATCH /fake")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Client testClientModel(Client body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /fake")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/x-www-form-urlencoded",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/x-www-form-urlencoded",
|
||||||
|
"Accept: application/json",
|
||||||
|
"enum_header_string_array: {enumHeaderStringArray}",
|
||||||
|
|
||||||
|
"enum_header_string: {enumHeaderString}"
|
||||||
|
})
|
||||||
|
void testEnumParameters(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List<String> enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test enum parameters
|
||||||
|
* To test enum parameters
|
||||||
|
* Note, this is equivalent to the other <code>testEnumParameters</code> method,
|
||||||
|
* but with the query parameters collected into a single Map parameter. This
|
||||||
|
* is convenient for services with optional query parameters, especially when
|
||||||
|
* used with the {@link TestEnumParametersQueryParams} class that allows for
|
||||||
|
* building up this map in a fluent style.
|
||||||
|
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||||
|
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||||
|
* @param enumFormStringArray Form parameter enum test (string array) (optional)
|
||||||
|
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
|
||||||
|
* @param queryParams Map of query parameters as name-value pairs
|
||||||
|
* <p>The following elements may be specified in the query map:</p>
|
||||||
|
* <ul>
|
||||||
|
* <li>enumQueryStringArray - Query parameter enum test (string array) (optional)</li>
|
||||||
|
* <li>enumQueryString - Query parameter enum test (string) (optional, default to -efg)</li>
|
||||||
|
* <li>enumQueryInteger - Query parameter enum test (double) (optional)</li>
|
||||||
|
* <li>enumQueryDouble - Query parameter enum test (double) (optional)</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/x-www-form-urlencoded",
|
||||||
|
"Accept: application/json",
|
||||||
|
"enum_header_string_array: {enumHeaderStringArray}",
|
||||||
|
|
||||||
|
"enum_header_string: {enumHeaderString}"
|
||||||
|
})
|
||||||
|
void testEnumParameters(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience class for generating query parameters for the
|
||||||
|
* <code>testEnumParameters</code> method in a fluent style.
|
||||||
|
*/
|
||||||
|
public static class TestEnumParametersQueryParams extends HashMap<String, Object> {
|
||||||
|
public TestEnumParametersQueryParams enumQueryStringArray(final List<String> value) {
|
||||||
|
put("enum_query_string_array", EncodingUtils.encodeCollection(value, "csv"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestEnumParametersQueryParams enumQueryString(final String value) {
|
||||||
|
put("enum_query_string", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestEnumParametersQueryParams enumQueryInteger(final Integer value) {
|
||||||
|
put("enum_query_integer", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestEnumParametersQueryParams enumQueryDouble(final Double value) {
|
||||||
|
put("enum_query_double", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fake endpoint to test group parameters (optional)
|
||||||
|
* Fake endpoint to test group parameters (optional)
|
||||||
|
* @param requiredStringGroup Required String in group parameters (required)
|
||||||
|
* @param requiredBooleanGroup Required Boolean in group parameters (required)
|
||||||
|
* @param requiredInt64Group Required Integer in group parameters (required)
|
||||||
|
* @param stringGroup String in group parameters (optional)
|
||||||
|
* @param booleanGroup Boolean in group parameters (optional)
|
||||||
|
* @param int64Group Integer in group parameters (optional)
|
||||||
|
*/
|
||||||
|
@RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
"required_boolean_group: {requiredBooleanGroup}",
|
||||||
|
|
||||||
|
"boolean_group: {booleanGroup}"
|
||||||
|
})
|
||||||
|
void testGroupParameters(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fake endpoint to test group parameters (optional)
|
||||||
|
* Fake endpoint to test group parameters (optional)
|
||||||
|
* Note, this is equivalent to the other <code>testGroupParameters</code> method,
|
||||||
|
* but with the query parameters collected into a single Map parameter. This
|
||||||
|
* is convenient for services with optional query parameters, especially when
|
||||||
|
* used with the {@link TestGroupParametersQueryParams} class that allows for
|
||||||
|
* building up this map in a fluent style.
|
||||||
|
* @param requiredBooleanGroup Required Boolean in group parameters (required)
|
||||||
|
* @param booleanGroup Boolean in group parameters (optional)
|
||||||
|
* @param queryParams Map of query parameters as name-value pairs
|
||||||
|
* <p>The following elements may be specified in the query map:</p>
|
||||||
|
* <ul>
|
||||||
|
* <li>requiredStringGroup - Required String in group parameters (required)</li>
|
||||||
|
* <li>requiredInt64Group - Required Integer in group parameters (required)</li>
|
||||||
|
* <li>stringGroup - String in group parameters (optional)</li>
|
||||||
|
* <li>int64Group - Integer in group parameters (optional)</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
"required_boolean_group: {requiredBooleanGroup}",
|
||||||
|
|
||||||
|
"boolean_group: {booleanGroup}"
|
||||||
|
})
|
||||||
|
void testGroupParameters(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience class for generating query parameters for the
|
||||||
|
* <code>testGroupParameters</code> method in a fluent style.
|
||||||
|
*/
|
||||||
|
public static class TestGroupParametersQueryParams extends HashMap<String, Object> {
|
||||||
|
public TestGroupParametersQueryParams requiredStringGroup(final Integer value) {
|
||||||
|
put("required_string_group", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestGroupParametersQueryParams requiredInt64Group(final Long value) {
|
||||||
|
put("required_int64_group", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestGroupParametersQueryParams stringGroup(final Integer value) {
|
||||||
|
put("string_group", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestGroupParametersQueryParams int64Group(final Long value) {
|
||||||
|
put("int64_group", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test inline additionalProperties
|
||||||
|
*
|
||||||
|
* @param param request body (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /fake/inline-additionalProperties")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void testInlineAdditionalProperties(Map<String, String> param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test json serialization of form data
|
||||||
|
*
|
||||||
|
* @param param field1 (required)
|
||||||
|
* @param param2 field2 (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /fake/jsonFormData")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/x-www-form-urlencoded",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void testJsonFormData(@Param("param") String param, @Param("param2") String param2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* To test the collection format in query parameters
|
||||||
|
* @param pipe (required)
|
||||||
|
* @param ioutil (required)
|
||||||
|
* @param http (required)
|
||||||
|
* @param url (required)
|
||||||
|
* @param context (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("PUT /fake/test-query-paramters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void testQueryParameterCollectionFormat(@Param("pipe") List<String> pipe, @Param("ioutil") List<String> ioutil, @Param("http") List<String> http, @Param("url") List<String> url, @Param("context") List<String> context);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* To test the collection format in query parameters
|
||||||
|
* Note, this is equivalent to the other <code>testQueryParameterCollectionFormat</code> method,
|
||||||
|
* but with the query parameters collected into a single Map parameter. This
|
||||||
|
* is convenient for services with optional query parameters, especially when
|
||||||
|
* used with the {@link TestQueryParameterCollectionFormatQueryParams} class that allows for
|
||||||
|
* building up this map in a fluent style.
|
||||||
|
* @param queryParams Map of query parameters as name-value pairs
|
||||||
|
* <p>The following elements may be specified in the query map:</p>
|
||||||
|
* <ul>
|
||||||
|
* <li>pipe - (required)</li>
|
||||||
|
* <li>ioutil - (required)</li>
|
||||||
|
* <li>http - (required)</li>
|
||||||
|
* <li>url - (required)</li>
|
||||||
|
* <li>context - (required)</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@RequestLine("PUT /fake/test-query-paramters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void testQueryParameterCollectionFormat(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience class for generating query parameters for the
|
||||||
|
* <code>testQueryParameterCollectionFormat</code> method in a fluent style.
|
||||||
|
*/
|
||||||
|
public static class TestQueryParameterCollectionFormatQueryParams extends HashMap<String, Object> {
|
||||||
|
public TestQueryParameterCollectionFormatQueryParams pipe(final List<String> value) {
|
||||||
|
put("pipe", EncodingUtils.encodeCollection(value, "csv"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestQueryParameterCollectionFormatQueryParams ioutil(final List<String> value) {
|
||||||
|
put("ioutil", EncodingUtils.encodeCollection(value, "csv"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestQueryParameterCollectionFormatQueryParams http(final List<String> value) {
|
||||||
|
put("http", EncodingUtils.encodeCollection(value, "ssv"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestQueryParameterCollectionFormatQueryParams url(final List<String> value) {
|
||||||
|
put("url", EncodingUtils.encodeCollection(value, "csv"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TestQueryParameterCollectionFormatQueryParams context(final List<String> value) {
|
||||||
|
put("context", EncodingUtils.encodeCollection(value, "multi"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.EncodingUtils;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.Client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import feign.*;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public interface FakeClassnameTags123Api extends ApiClient.Api {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test class name in snake case
|
||||||
|
* To test class name in snake case
|
||||||
|
* @param body client model (required)
|
||||||
|
* @return Client
|
||||||
|
*/
|
||||||
|
@RequestLine("PATCH /fake_classname_test")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Client testClassname(Client body);
|
||||||
|
}
|
@ -0,0 +1,201 @@
|
|||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.EncodingUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import org.openapitools.client.model.ModelApiResponse;
|
||||||
|
import org.openapitools.client.model.Pet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import feign.*;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public interface PetApi extends ApiClient.Api {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new pet to the store
|
||||||
|
*
|
||||||
|
* @param body Pet object that needs to be added to the store (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /pet")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void addPet(Pet body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*
|
||||||
|
* @param petId Pet id to delete (required)
|
||||||
|
* @param apiKey (optional)
|
||||||
|
*/
|
||||||
|
@RequestLine("DELETE /pet/{petId}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
"api_key: {apiKey}"
|
||||||
|
})
|
||||||
|
void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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>
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /pet/findByStatus?status={status}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
List<Pet> findPetsByStatus(@Param("status") List<String> status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by status
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
* Note, this is equivalent to the other <code>findPetsByStatus</code> method,
|
||||||
|
* but with the query parameters collected into a single Map parameter. This
|
||||||
|
* is convenient for services with optional query parameters, especially when
|
||||||
|
* used with the {@link FindPetsByStatusQueryParams} class that allows for
|
||||||
|
* building up this map in a fluent style.
|
||||||
|
* @param queryParams Map of query parameters as name-value pairs
|
||||||
|
* <p>The following elements may be specified in the query map:</p>
|
||||||
|
* <ul>
|
||||||
|
* <li>status - Status values that need to be considered for filter (required)</li>
|
||||||
|
* </ul>
|
||||||
|
* @return List<Pet>
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /pet/findByStatus?status={status}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
List<Pet> findPetsByStatus(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience class for generating query parameters for the
|
||||||
|
* <code>findPetsByStatus</code> method in a fluent style.
|
||||||
|
*/
|
||||||
|
public static class FindPetsByStatusQueryParams extends HashMap<String, Object> {
|
||||||
|
public FindPetsByStatusQueryParams status(final List<String> value) {
|
||||||
|
put("status", EncodingUtils.encodeCollection(value, "csv"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* @param tags Tags to filter by (required)
|
||||||
|
* @return Set<Pet>
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /pet/findByTags?tags={tags}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Set<Pet> findPetsByTags(@Param("tags") Set<String> tags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* Note, this is equivalent to the other <code>findPetsByTags</code> method,
|
||||||
|
* but with the query parameters collected into a single Map parameter. This
|
||||||
|
* is convenient for services with optional query parameters, especially when
|
||||||
|
* used with the {@link FindPetsByTagsQueryParams} class that allows for
|
||||||
|
* building up this map in a fluent style.
|
||||||
|
* @param queryParams Map of query parameters as name-value pairs
|
||||||
|
* <p>The following elements may be specified in the query map:</p>
|
||||||
|
* <ul>
|
||||||
|
* <li>tags - Tags to filter by (required)</li>
|
||||||
|
* </ul>
|
||||||
|
* @return Set<Pet>
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /pet/findByTags?tags={tags}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Set<Pet> findPetsByTags(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience class for generating query parameters for the
|
||||||
|
* <code>findPetsByTags</code> method in a fluent style.
|
||||||
|
*/
|
||||||
|
public static class FindPetsByTagsQueryParams extends HashMap<String, Object> {
|
||||||
|
public FindPetsByTagsQueryParams tags(final Set<String> value) {
|
||||||
|
put("tags", EncodingUtils.encodeCollection(value, "csv"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find pet by ID
|
||||||
|
* Returns a single pet
|
||||||
|
* @param petId ID of pet to return (required)
|
||||||
|
* @return Pet
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /pet/{petId}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Pet getPetById(@Param("petId") Long petId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*
|
||||||
|
* @param body Pet object that needs to be added to the store (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("PUT /pet")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void updatePet(Pet body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /pet/{petId}")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: application/x-www-form-urlencoded",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /pet/{petId}/uploadImage")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: multipart/form-data",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: multipart/form-data",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
ModelApiResponse uploadFileWithRequiredFile(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata);
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.EncodingUtils;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.Order;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import feign.*;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public interface StoreApi extends ApiClient.Api {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
*/
|
||||||
|
@RequestLine("DELETE /store/order/{orderId}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void deleteOrder(@Param("orderId") String orderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns pet inventories by status
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
* @return Map<String, Integer>
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /store/inventory")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Map<String, Integer> getInventory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /store/order/{orderId}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Order getOrderById(@Param("orderId") Long orderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
* @param body order placed for purchasing the pet (required)
|
||||||
|
* @return Order
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /store/order")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
Order placeOrder(Order body);
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.EncodingUtils;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import feign.*;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public interface UserApi extends ApiClient.Api {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @param body Created user object (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /user")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void createUser(User body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
* @param body List of user object (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /user/createWithArray")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void createUsersWithArrayInput(List<User> body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
* @param body List of user object (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("POST /user/createWithList")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void createUsersWithListInput(List<User> body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @param username The name that needs to be deleted (required)
|
||||||
|
*/
|
||||||
|
@RequestLine("DELETE /user/{username}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void deleteUser(@Param("username") String username);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user by user name
|
||||||
|
*
|
||||||
|
* @param username The name that needs to be fetched. Use user1 for testing. (required)
|
||||||
|
* @return User
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /user/{username}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
User getUserByName(@Param("username") String username);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /user/login?username={username}&password={password}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
String loginUser(@Param("username") String username, @Param("password") String password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs user into the system
|
||||||
|
*
|
||||||
|
* Note, this is equivalent to the other <code>loginUser</code> method,
|
||||||
|
* but with the query parameters collected into a single Map parameter. This
|
||||||
|
* is convenient for services with optional query parameters, especially when
|
||||||
|
* used with the {@link LoginUserQueryParams} class that allows for
|
||||||
|
* building up this map in a fluent style.
|
||||||
|
* @param queryParams Map of query parameters as name-value pairs
|
||||||
|
* <p>The following elements may be specified in the query map:</p>
|
||||||
|
* <ul>
|
||||||
|
* <li>username - The user name for login (required)</li>
|
||||||
|
* <li>password - The password for login in clear text (required)</li>
|
||||||
|
* </ul>
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /user/login?username={username}&password={password}")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
String loginUser(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience class for generating query parameters for the
|
||||||
|
* <code>loginUser</code> method in a fluent style.
|
||||||
|
*/
|
||||||
|
public static class LoginUserQueryParams extends HashMap<String, Object> {
|
||||||
|
public LoginUserQueryParams username(final String value) {
|
||||||
|
put("username", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public LoginUserQueryParams password(final String value) {
|
||||||
|
put("password", EncodingUtils.encode(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RequestLine("GET /user/logout")
|
||||||
|
@Headers({
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void logoutUser();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
*/
|
||||||
|
@RequestLine("PUT /user/{username}")
|
||||||
|
@Headers({
|
||||||
|
"Content-Type: */*",
|
||||||
|
"Accept: application/json",
|
||||||
|
})
|
||||||
|
void updateUser(@Param("username") String username, User body);
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import feign.RequestInterceptor;
|
||||||
|
import feign.RequestTemplate;
|
||||||
|
|
||||||
|
public class ApiKeyAuth implements RequestInterceptor {
|
||||||
|
private final String location;
|
||||||
|
private final String paramName;
|
||||||
|
|
||||||
|
private String apiKey;
|
||||||
|
|
||||||
|
public ApiKeyAuth(String location, String paramName) {
|
||||||
|
this.location = location;
|
||||||
|
this.paramName = paramName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParamName() {
|
||||||
|
return paramName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiKey() {
|
||||||
|
return apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKey(String apiKey) {
|
||||||
|
this.apiKey = apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(RequestTemplate template) {
|
||||||
|
if ("query".equals(location)) {
|
||||||
|
template.query(paramName, apiKey);
|
||||||
|
} else if ("header".equals(location)) {
|
||||||
|
template.header(paramName, apiKey);
|
||||||
|
} else if ("cookie".equals(location)) {
|
||||||
|
template.header("Cookie", String.format("%s=%s", paramName, apiKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import feign.RequestInterceptor;
|
||||||
|
import feign.RequestTemplate;
|
||||||
|
import feign.auth.BasicAuthRequestInterceptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interceptor that adds the request header needed to use HTTP basic authentication.
|
||||||
|
*/
|
||||||
|
public class HttpBasicAuth implements RequestInterceptor {
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCredentials(String username, String password) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(RequestTemplate template) {
|
||||||
|
RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor(username, password);
|
||||||
|
requestInterceptor.apply(template);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import feign.RequestInterceptor;
|
||||||
|
import feign.RequestTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interceptor that adds the request header needed to use HTTP bearer authentication.
|
||||||
|
*/
|
||||||
|
public class HttpBearerAuth implements RequestInterceptor {
|
||||||
|
private final String scheme;
|
||||||
|
private String bearerToken;
|
||||||
|
|
||||||
|
public HttpBearerAuth(String scheme) {
|
||||||
|
this.scheme = scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||||
|
*/
|
||||||
|
public String getBearerToken() {
|
||||||
|
return bearerToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||||
|
*/
|
||||||
|
public void setBearerToken(String bearerToken) {
|
||||||
|
this.bearerToken = bearerToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(RequestTemplate template) {
|
||||||
|
if(bearerToken == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
template.header("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String upperCaseBearer(String scheme) {
|
||||||
|
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,198 @@
|
|||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.apache.oltu.oauth2.client.HttpClient;
|
||||||
|
import org.apache.oltu.oauth2.client.OAuthClient;
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest;
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder;
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
|
||||||
|
import org.apache.oltu.oauth2.client.response.OAuthClientResponse;
|
||||||
|
import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory;
|
||||||
|
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 org.apache.oltu.oauth2.common.token.BasicOAuthToken;
|
||||||
|
|
||||||
|
import feign.Client;
|
||||||
|
import feign.Request.HttpMethod;
|
||||||
|
import feign.Request.Options;
|
||||||
|
import feign.RequestInterceptor;
|
||||||
|
import feign.RequestTemplate;
|
||||||
|
import feign.Response;
|
||||||
|
import feign.RetryableException;
|
||||||
|
import feign.Util;
|
||||||
|
import org.openapitools.client.StringUtil;
|
||||||
|
|
||||||
|
|
||||||
|
public class OAuth implements RequestInterceptor {
|
||||||
|
|
||||||
|
static final int MILLIS_PER_SECOND = 1000;
|
||||||
|
|
||||||
|
public interface AccessTokenListener {
|
||||||
|
void notify(BasicOAuthToken token);
|
||||||
|
}
|
||||||
|
|
||||||
|
private volatile String accessToken;
|
||||||
|
private Long expirationTimeMillis;
|
||||||
|
private OAuthClient oauthClient;
|
||||||
|
private TokenRequestBuilder tokenRequestBuilder;
|
||||||
|
private AuthenticationRequestBuilder authenticationRequestBuilder;
|
||||||
|
private AccessTokenListener accessTokenListener;
|
||||||
|
|
||||||
|
public OAuth(Client client, TokenRequestBuilder requestBuilder) {
|
||||||
|
this.oauthClient = new OAuthClient(new OAuthFeignClient(client));
|
||||||
|
this.tokenRequestBuilder = requestBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OAuth(Client client, OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||||
|
this(client, OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes));
|
||||||
|
|
||||||
|
switch(flow) {
|
||||||
|
case accessCode:
|
||||||
|
case implicit:
|
||||||
|
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
|
||||||
|
break;
|
||||||
|
case password:
|
||||||
|
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
|
||||||
|
break;
|
||||||
|
case application:
|
||||||
|
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OAuth(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||||
|
this(new Client.Default(null, null), flow, authorizationUrl, tokenUrl, scopes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(RequestTemplate template) {
|
||||||
|
// If the request already have an authorization (eg. Basic auth), do nothing
|
||||||
|
if (template.headers().containsKey("Authorization")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If first time, get the token
|
||||||
|
if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) {
|
||||||
|
updateAccessToken(template);
|
||||||
|
}
|
||||||
|
if (getAccessToken() != null) {
|
||||||
|
template.header("Authorization", "Bearer " + getAccessToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void updateAccessToken(RequestTemplate template) {
|
||||||
|
OAuthJSONAccessTokenResponse accessTokenResponse;
|
||||||
|
try {
|
||||||
|
accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request());
|
||||||
|
}
|
||||||
|
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
|
||||||
|
setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn());
|
||||||
|
if (accessTokenListener != null) {
|
||||||
|
accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
|
||||||
|
this.accessTokenListener = accessTokenListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized String getAccessToken() {
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void setAccessToken(String accessToken, Long expiresIn) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TokenRequestBuilder getTokenRequestBuilder() {
|
||||||
|
return tokenRequestBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) {
|
||||||
|
this.tokenRequestBuilder = tokenRequestBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
|
||||||
|
return authenticationRequestBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
|
||||||
|
this.authenticationRequestBuilder = authenticationRequestBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OAuthClient getOauthClient() {
|
||||||
|
return oauthClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOauthClient(OAuthClient oauthClient) {
|
||||||
|
this.oauthClient = oauthClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOauthClient(Client client) {
|
||||||
|
this.oauthClient = new OAuthClient( new OAuthFeignClient(client));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class OAuthFeignClient implements HttpClient {
|
||||||
|
|
||||||
|
private Client client;
|
||||||
|
|
||||||
|
public OAuthFeignClient() {
|
||||||
|
this.client = new Client.Default(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OAuthFeignClient(Client client) {
|
||||||
|
this.client = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends OAuthClientResponse> T execute(OAuthClientRequest request, Map<String, String> headers,
|
||||||
|
String requestMethod, Class<T> responseClass)
|
||||||
|
throws OAuthSystemException, OAuthProblemException {
|
||||||
|
|
||||||
|
RequestTemplate req = new RequestTemplate()
|
||||||
|
.append(request.getLocationUri())
|
||||||
|
.method(requestMethod)
|
||||||
|
.body(request.getBody());
|
||||||
|
|
||||||
|
for (Entry<String, String> entry : headers.entrySet()) {
|
||||||
|
req.header(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
Response feignResponse;
|
||||||
|
String body = "";
|
||||||
|
try {
|
||||||
|
feignResponse = client.execute(req.request(), new Options());
|
||||||
|
body = Util.toString(feignResponse.body().asReader());
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new OAuthSystemException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
String contentType = null;
|
||||||
|
Collection<String> contentTypeHeader = feignResponse.headers().get("Content-Type");
|
||||||
|
if(contentTypeHeader != null) {
|
||||||
|
contentType = StringUtil.join(contentTypeHeader.toArray(new String[0]), ";");
|
||||||
|
}
|
||||||
|
|
||||||
|
return OAuthClientResponseFactory.createCustomResponse(
|
||||||
|
body,
|
||||||
|
contentType,
|
||||||
|
feignResponse.status(),
|
||||||
|
responseClass
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
// Nothing to do here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user