diff --git a/.github/workflows/samples-java-client-jdk17.yaml b/.github/workflows/samples-java-client-jdk17.yaml index 3b4daf563ce0..a86a3084afb1 100644 --- a/.github/workflows/samples-java-client-jdk17.yaml +++ b/.github/workflows/samples-java-client-jdk17.yaml @@ -17,6 +17,7 @@ on: - samples/client/petstore/java/webclient-useSingleRequestParameter/** - samples/client/others/java/restclient-enum-in-multipart/** - samples/client/others/java/restclient-sealedInterface/** + - samples/client/others/java/restclient-jackson-default-impl/** - samples/client/others/java/restclient-useAbstractionForFiles/** - samples/client/petstore/java/jersey3-oneOf/** - samples/client/petstore/java/jersey3-jackson3/** @@ -37,6 +38,7 @@ on: - samples/client/petstore/java/webclient-useSingleRequestParameter/** - samples/client/others/java/restclient-enum-in-multipart/** - samples/client/others/java/restclient-sealedInterface/** + - samples/client/others/java/restclient-jackson-default-impl/** - samples/client/others/java/restclient-useAbstractionForFiles/** - samples/client/petstore/java/jersey3-oneOf/** - samples/client/petstore/java/jersey3-jackson3/** @@ -72,6 +74,7 @@ jobs: - samples/client/petstore/java/webclient-useSingleRequestParameter - samples/client/others/java/restclient-enum-in-multipart - samples/client/others/java/restclient-sealedInterface + - samples/client/others/java/restclient-jackson-default-impl - samples/client/others/java/restclient-useAbstractionForFiles - samples/client/petstore/java/jersey3-oneOf - samples/client/petstore/java/jersey3-jackson3 diff --git a/.github/workflows/samples-jdk17.yaml b/.github/workflows/samples-jdk17.yaml index 9a2a997d6628..227754851266 100644 --- a/.github/workflows/samples-jdk17.yaml +++ b/.github/workflows/samples-jdk17.yaml @@ -20,6 +20,7 @@ on: - samples/openapi3/server/petstore/springboot-3-include-http-request-context/** - samples/server/petstore/springboot-x-implements-skip/** - samples/server/petstore/java-camel/** + - samples/server/petstore/java-camel-oneof-jackson-default-impl/** - samples/server/petstore/java-helidon-server/v3/mp/** - samples/server/petstore/java-helidon-server/v3/se/** - samples/server/petstore/jaxrs-spec-sealed/** @@ -44,6 +45,7 @@ on: - samples/openapi3/server/petstore/springboot-3-include-http-request-context/** - samples/server/petstore/springboot-x-implements-skip/** - samples/server/petstore/java-camel/** + - samples/server/petstore/java-camel-oneof-jackson-default-impl/** - samples/server/petstore/java-helidon-server/v3/mp/** - samples/server/petstore/java-helidon-server/v3/se/** - samples/server/petstore/jaxrs-spec-sealed/** @@ -74,6 +76,7 @@ jobs: - samples/openapi3/server/petstore/springboot-3-include-http-request-context - samples/server/petstore/springboot-x-implements-skip - samples/server/petstore/java-camel/ + - samples/server/petstore/java-camel-oneof-jackson-default-impl - samples/server/petstore/java-helidon-server/v3/mp/ - samples/server/petstore/java-helidon-server/v3/se - samples/server/petstore/jaxrs-spec-sealed diff --git a/.github/workflows/samples-kotlin-client.yaml b/.github/workflows/samples-kotlin-client.yaml index 0abe53a107cb..b25bdb4ec9a1 100644 --- a/.github/workflows/samples-kotlin-client.yaml +++ b/.github/workflows/samples-kotlin-client.yaml @@ -9,6 +9,7 @@ on: - samples/client/others/kotlin-jvm-spring-3-restclient-nullable-return/** - samples/client/others/kotlin-oneOf-anyOf-kotlinx-serialization*/** - samples/client/others/kotlin-oneOf-discriminator-kotlinx-serialization*/** + - samples/client/others/kotlin-oneof-jackson-default-impl/** pull_request: paths: - 'samples/client/petstore/kotlin*/**' @@ -17,6 +18,7 @@ on: - samples/client/others/kotlin-jvm-spring-3-restclient-nullable-return/** - samples/client/others/kotlin-oneOf-anyOf-kotlinx-serialization*/** - samples/client/others/kotlin-oneOf-discriminator-kotlinx-serialization*/** + - samples/client/others/kotlin-oneof-jackson-default-impl/** jobs: build: @@ -82,6 +84,7 @@ jobs: - samples/client/others/kotlin-integer-enum - samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization - samples/client/others/kotlin-oneOf-discriminator-kotlinx-serialization + - samples/client/others/kotlin-oneof-jackson-default-impl - samples/client/others/kotlin-oneOf-anyOf-kotlinx-serialization - samples/client/others/kotlin-oneOf-anyOf-kotlinx-serialization-nonPublicApi - samples/client/others/kotlin-oneOf-anyOf-kotlinx-serialization-explicitApi diff --git a/.github/workflows/samples-kotlin-server-jdk17.yaml b/.github/workflows/samples-kotlin-server-jdk17.yaml index f334f8887d6b..2d5fb356bfd5 100644 --- a/.github/workflows/samples-kotlin-server-jdk17.yaml +++ b/.github/workflows/samples-kotlin-server-jdk17.yaml @@ -14,6 +14,7 @@ on: - 'samples/server/petstore/kotlin-spring-sealed-interfaces/**' - 'samples/server/petstore/kotlin-springboot-sort-validation/**' - 'samples/server/petstore/kotlin-springboot-paged-model/**' + - 'samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/**' - 'samples/server/petstore/kotlin-server/ktor-delegate-pattern/generated/**' # comment out due to gradle build failure # - samples/server/petstore/kotlin-spring-default/** @@ -30,6 +31,7 @@ on: - 'samples/server/petstore/kotlin-spring-sealed-interfaces/**' - 'samples/server/petstore/kotlin-springboot-sort-validation/**' - 'samples/server/petstore/kotlin-springboot-paged-model/**' + - 'samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/**' - 'samples/server/petstore/kotlin-server/ktor-delegate-pattern/generated/**' # comment out due to gradle build failure # - samples/server/petstore/kotlin-spring-default/** @@ -75,6 +77,7 @@ jobs: - samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped - samples/server/petstore/kotlin-spring-declarative-interface-wrapped - samples/server/petstore/kotlin-spring-sealed-interfaces + - samples/server/petstore/kotlin-spring-oneof-jackson-default-impl - samples/server/petstore/kotlin-springboot-sort-validation - samples/server/petstore/kotlin-springboot-paged-model # comment out due to gradle build failure diff --git a/.github/workflows/samples-spring-jdk17.yaml b/.github/workflows/samples-spring-jdk17.yaml index 83380bed6913..b9d5b39f9b19 100644 --- a/.github/workflows/samples-spring-jdk17.yaml +++ b/.github/workflows/samples-spring-jdk17.yaml @@ -21,6 +21,7 @@ on: - samples/server/others/springboot-pre-authorize/** - samples/openapi3/server/petstore/spring-boot-oneof-sealed/** - samples/openapi3/server/petstore/spring-boot-oneof-interface/** + - samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/** - samples/client/petstore/spring-http-interface-oauth/** pull_request: paths: @@ -42,6 +43,7 @@ on: - samples/server/others/springboot-pre-authorize/** - samples/openapi3/server/petstore/spring-boot-oneof-sealed/** - samples/openapi3/server/petstore/spring-boot-oneof-interface/** + - samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/** - samples/client/petstore/spring-http-interface-oauth/** jobs: build: @@ -71,6 +73,7 @@ jobs: - samples/server/others/springboot-pre-authorize - samples/openapi3/server/petstore/spring-boot-oneof-sealed - samples/openapi3/server/petstore/spring-boot-oneof-interface + - samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl - samples/client/petstore/spring-http-interface-oauth steps: - uses: actions/checkout@v7 diff --git a/bin/configs/java-camel-oneof-jackson-default-impl.yaml b/bin/configs/java-camel-oneof-jackson-default-impl.yaml new file mode 100644 index 000000000000..5adf86951ab8 --- /dev/null +++ b/bin/configs/java-camel-oneof-jackson-default-impl.yaml @@ -0,0 +1,25 @@ +generatorName: java-camel +outputDir: samples/server/petstore/java-camel-oneof-jackson-default-impl +inputSpec: modules/openapi-generator/src/test/resources/3_0/jackson-default-impl-oneof.yaml +templateDir: modules/openapi-generator/src/main/resources/java-camel-server +globalProperties: + apiTests: "false" + modelTests: "false" +additionalProperties: + hideGenerationTimestamp: true + artifactId: java-camel-oneof-jackson-default-impl + camelRestBindingMode: "auto" + performBeanValidation: true + camelDataformatProperties: "json.out.disableFeatures=WRITE_DATES_AS_TIMESTAMPS" + jackson: true + camelUseDefaultValidationErrorProcessor: true + camelRestClientRequestValidation: true + camelSecurityDefinitions: true + implicitHeaders: true + useSpringBoot3: false + useOneOfInterfaces: "true" + useDeductionForOneOfInterfaces: "true" + generateJsonIncludeAnnotations: "true" + generateJsonSetterNullsAnnotations: "true" + typeInfoDefaultImpls: + Fruit: Apple diff --git a/bin/configs/java-restclient-jackson-default-impl.yaml b/bin/configs/java-restclient-jackson-default-impl.yaml new file mode 100644 index 000000000000..680d6ff3cba7 --- /dev/null +++ b/bin/configs/java-restclient-jackson-default-impl.yaml @@ -0,0 +1,12 @@ +generatorName: java +outputDir: samples/client/others/java/restclient-jackson-default-impl +library: restclient +inputSpec: modules/openapi-generator/src/test/resources/3_0/jackson-default-impl-oneof.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: restclient-jackson-default-impl + hideGenerationTimestamp: "true" + useOneOfInterfaces: "true" + useDeductionForOneOfInterfaces: "true" + typeInfoDefaultImpls: + Fruit: Apple diff --git a/bin/configs/kotlin-oneof-jackson-default-impl.yaml b/bin/configs/kotlin-oneof-jackson-default-impl.yaml new file mode 100644 index 000000000000..855031973dbf --- /dev/null +++ b/bin/configs/kotlin-oneof-jackson-default-impl.yaml @@ -0,0 +1,12 @@ +generatorName: kotlin +outputDir: samples/client/others/kotlin-oneof-jackson-default-impl +inputSpec: modules/openapi-generator/src/test/resources/3_0/jackson-default-impl-oneof.yaml +templateDir: modules/openapi-generator/src/main/resources/kotlin-client +additionalProperties: + artifactId: kotlin-oneof-jackson-default-impl + serializationLibrary: jackson + library: jvm-retrofit2 + enumUnknownDefaultCase: true + useOneOfInterfaces: "true" + typeInfoDefaultImpls: + Fruit: Apple diff --git a/bin/configs/kotlin-spring-oneof-jackson-default-impl.yaml b/bin/configs/kotlin-spring-oneof-jackson-default-impl.yaml new file mode 100644 index 000000000000..e146bf9100a4 --- /dev/null +++ b/bin/configs/kotlin-spring-oneof-jackson-default-impl.yaml @@ -0,0 +1,18 @@ +generatorName: kotlin-spring +outputDir: samples/server/petstore/kotlin-spring-oneof-jackson-default-impl +library: spring-boot +inputSpec: modules/openapi-generator/src/test/resources/3_0/jackson-default-impl-oneof.yaml +templateDir: modules/openapi-generator/src/main/resources/kotlin-spring +additionalProperties: + artifactId: kotlin-spring-oneof-jackson-default-impl + documentationProvider: none + annotationLibrary: none + useSwaggerUI: "false" + interfaceOnly: "true" + useSpringBoot3: "true" + useOneOfInterfaces: "true" + useDeductionForOneOfInterfaces: "true" + generateJsonIncludeAnnotations: "true" + generateJsonSetterNullsAnnotations: "true" + typeInfoDefaultImpls: + Fruit: Apple diff --git a/bin/configs/spring-boot-oneof-jackson-default-impl.yaml b/bin/configs/spring-boot-oneof-jackson-default-impl.yaml new file mode 100644 index 000000000000..90d68aa42c68 --- /dev/null +++ b/bin/configs/spring-boot-oneof-jackson-default-impl.yaml @@ -0,0 +1,16 @@ +generatorName: spring +outputDir: samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl +inputSpec: modules/openapi-generator/src/test/resources/3_0/jackson-default-impl-oneof.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaSpring +additionalProperties: + groupId: org.openapitools.openapi3 + documentationProvider: springdoc + artifactId: springboot-oneof-jackson-default-impl + snapshotVersion: "true" + hideGenerationTimestamp: "true" + useOneOfInterfaces: "true" + useDeductionForOneOfInterfaces: "true" + generateJsonIncludeAnnotations: "true" + generateJsonSetterNullsAnnotations: "true" + typeInfoDefaultImpls: + Fruit: Apple diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index 9f6e4d1e10a5..038c445f247a 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -113,6 +113,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a 'page' pagination-metadata property) and replace their generated references with PagedModel<T>. By default this uses a generated type in the config package (default 'org.openapitools.configuration'), but `importMappings.PagedModel` can override it to a custom/FQCN-mapped type. The detected page schemas and the pagination metadata schema are suppressed from code generation.| |false| |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |title|server title name or client service name| |OpenAPI Spring| +|typeInfoDefaultImpls|Map of schema name to default Jackson deserialization class for @JsonTypeInfo(defaultImpl=...). Applies to both deduction-based and discriminator-based oneOf interfaces. Overrides x-jackson-default-impl when both are set for the same schema. Example: yaml `typeInfoDefaultImpls: {PostRegistrationRequest: PostRegistrationBasicRequest}`| |empty map| |unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false| |useBeanValidation|Use BeanValidation API annotations| |true| |useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false| @@ -159,6 +160,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null |x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null |x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null +|x-jackson-default-impl|Specifies the default implementation class name for Jackson @JsonTypeInfo(defaultImpl=...) on a oneOf interface schema (deduction-based or discriminator-based). Can be overridden per-schema by the `typeInfoDefaultImpls` generator option.|MODEL|null |x-jackson-json-include-policy|Manually override the resolved Jackson `@JsonInclude` policy for this property. Must be one of `ALWAYS`, `NON_NULL`, `NON_ABSENT`, `NON_EMPTY`, `NON_DEFAULT`, `USE_DEFAULTS`, `CUSTOM`, or `NONE` to emit no annotation. Always wins over the automatic required/nullable matrix and the `optionalNonNullPropertyJsonInclude` option.|FIELD|resolved automatically per the required/nullable matrix |x-jackson-json-setter-nulls|Manually override the resolved Jackson `@JsonSetter(nulls = ...)` deserialization null-handling for this property. Must be one of `SKIP` (ignore an explicit JSON null, keeping the default), `FAIL` (reject an explicit JSON null), or `NONE` to emit no annotation. Always wins over the automatic `openApiNullable` default and the `optionalNonNullPropertyJsonSetterNulls` option, and is honored regardless of `generateJsonSetterNullsAnnotations` or whether the property is required/nullable.|FIELD|resolved automatically per the openApiNullable default diff --git a/docs/generators/java.md b/docs/generators/java.md index 6740780102b9..d75453b54044 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -93,6 +93,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.| |false| |supportVertxFuture|Also generate api methods that return a vertx Future instead of taking a callback. Only `vertx` supports this option. Requires vertx 4 or greater.| |false| |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| +|typeInfoDefaultImpls|Map of schema name to default Jackson deserialization class for @JsonTypeInfo(defaultImpl=...). Applies to both deduction-based and discriminator-based oneOf interfaces. Overrides x-jackson-default-impl when both are set for the same schema. Example: yaml `typeInfoDefaultImpls: {PostRegistrationRequest: PostRegistrationBasicRequest}`| |empty map| |useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries| |false| |useBeanValidation|Use BeanValidation API annotations| |false| |useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false| @@ -130,6 +131,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null |x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null |x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono/Flux` or `return T/List/Set` & execute `.block()` inside generated method)|OPERATION|false +|x-jackson-default-impl|Specifies the default implementation class name for Jackson @JsonTypeInfo(defaultImpl=...) on a oneOf interface schema (deduction-based or discriminator-based). Can be overridden per-schema by the `typeInfoDefaultImpls` generator option.|MODEL|null ## IMPORT MAPPING diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index 31e78d3a8e73..b22bc0eb2e78 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -65,6 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a 'page' pagination-metadata property) and replace their generated references with PagedModel<T>. By default this uses a generated type in the config package (default 'org.openapitools.configuration'), but `importMappings.PagedModel` can override it to a custom/FQCN-mapped type. The detected page schemas and the pagination metadata schema are suppressed from code generation.| |false| |suspendFunctions|Whether to generate suspend functions for API operations. Useful for Spring MVC with Kotlin coroutines without requiring the full reactive stack.| |false| |title|server title name or client service name| |OpenAPI Kotlin Spring| +|typeInfoDefaultImpls|Map of schema name to default Jackson deserialization class for @JsonTypeInfo(defaultImpl=...). Applies to both deduction-based and discriminator-based oneOf interfaces. Overrides x-jackson-default-impl when both are set for the same schema. Example: yaml `typeInfoDefaultImpls: {PostRegistrationRequest: PostRegistrationBasicRequest}`| |empty map| |useBeanValidation|Use BeanValidation API annotations to validate data types| |true| |useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false| |useEnumValueInterface|Generate a ValuedEnum<T> interface in the config package and make all generated enums implement it, providing a common typed way to access the underlying enum value. Use `importMappings.ValuedEnum` to substitute a custom/library-provided interface instead of generating one.| |false| @@ -90,6 +91,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null |x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| |x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null +|x-jackson-default-impl|Specifies the default implementation class name for Jackson @JsonTypeInfo(defaultImpl=...) on a oneOf interface schema (deduction-based or discriminator-based). Can be overridden per-schema by the `typeInfoDefaultImpls` generator option.|MODEL|null |x-operation-extra-annotation|Custom annotation(s) to be added to operation; accepts a string or list of strings|OPERATION|null |x-extra-imports|Custom import(s) to add to the generated file that declares the annotated model, property, operation, or parameter (e.g. so custom annotations can be referenced by their short name); accepts a string or list of strings. Values are emitted verbatim (Kotlin alias imports supported) and only exact duplicates are removed|MODEL, FIELD, OPERATION, OPERATION_PARAMETER|null |x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index 46a8a577c96b..a6268f931aa4 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null| |sourceFolder|source folder for generated code| |src/main/kotlin| |supportAndroidApiLevel25AndBelow|[WARNING] This flag will generate code that has a known security vulnerability. It uses `kotlin.io.createTempFile` instead of `java.nio.file.Files.createTempFile` in order to support Android API level 25 and below. For more info, please check the following links https://github.com/OpenAPITools/openapi-generator/security/advisories/GHSA-23x4-m842-fmwf, https://github.com/OpenAPITools/openapi-generator/pull/9284| |false| +|typeInfoDefaultImpls|Map of schema name to default Jackson deserialization class for @JsonTypeInfo(defaultImpl=...). For kotlin-client this applies to discriminator-based oneOf interfaces only (deduction-based oneOf is not supported by the kotlin-client templates). Overrides x-jackson-default-impl when both are set for the same schema. Requires the jackson serialization library. Example: yaml `typeInfoDefaultImpls: {PostRegistrationRequest: PostRegistrationBasicRequest}`| |empty map| |useCoroutines|Whether to use the Coroutines adapter with the retrofit2 library.| |false| |useJackson3|Use Jackson 3 dependencies (tools.jackson package). Requires serializationLibrary=jackson. Incompatible with openApiNullable.| |false| |useNonAsciiHeaders|Allow to use non-ascii headers with the okhttp library| |false| @@ -64,6 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | -------------- | ----------- | -------------- | ------------- | |x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null |x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null +|x-jackson-default-impl|Specifies the default implementation class name for Jackson @JsonTypeInfo(defaultImpl=...) on a oneOf interface schema (deduction-based or discriminator-based). Can be overridden per-schema by the `typeInfoDefaultImpls` generator option.|MODEL|null ## IMPORT MAPPING diff --git a/docs/generators/spring.md b/docs/generators/spring.md index a055dba2547b..5b02d5e705b0 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -106,6 +106,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a 'page' pagination-metadata property) and replace their generated references with PagedModel<T>. By default this uses a generated type in the config package (default 'org.openapitools.configuration'), but `importMappings.PagedModel` can override it to a custom/FQCN-mapped type. The detected page schemas and the pagination metadata schema are suppressed from code generation.| |false| |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |title|server title name or client service name| |OpenAPI Spring| +|typeInfoDefaultImpls|Map of schema name to default Jackson deserialization class for @JsonTypeInfo(defaultImpl=...). Applies to both deduction-based and discriminator-based oneOf interfaces. Overrides x-jackson-default-impl when both are set for the same schema. Example: yaml `typeInfoDefaultImpls: {PostRegistrationRequest: PostRegistrationBasicRequest}`| |empty map| |unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false| |useBeanValidation|Use BeanValidation API annotations| |true| |useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false| @@ -152,6 +153,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null |x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null |x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null +|x-jackson-default-impl|Specifies the default implementation class name for Jackson @JsonTypeInfo(defaultImpl=...) on a oneOf interface schema (deduction-based or discriminator-based). Can be overridden per-schema by the `typeInfoDefaultImpls` generator option.|MODEL|null |x-jackson-json-include-policy|Manually override the resolved Jackson `@JsonInclude` policy for this property. Must be one of `ALWAYS`, `NON_NULL`, `NON_ABSENT`, `NON_EMPTY`, `NON_DEFAULT`, `USE_DEFAULTS`, `CUSTOM`, or `NONE` to emit no annotation. Always wins over the automatic required/nullable matrix and the `optionalNonNullPropertyJsonInclude` option.|FIELD|resolved automatically per the required/nullable matrix |x-jackson-json-setter-nulls|Manually override the resolved Jackson `@JsonSetter(nulls = ...)` deserialization null-handling for this property. Must be one of `SKIP` (ignore an explicit JSON null, keeping the default), `FAIL` (reject an explicit JSON null), or `NONE` to emit no annotation. Always wins over the automatic `openApiNullable` default and the `optionalNonNullPropertyJsonSetterNulls` option, and is honored regardless of `generateJsonSetterNullsAnnotations` or whether the property is required/nullable.|FIELD|resolved automatically per the openApiNullable default diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index 03faf2e32189..88cea8117d2f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -274,6 +274,9 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, // Codegen constants should define a description and provide proper input validation for the value of serializationLibrary public static final String SERIALIZATION_LIBRARY = "serializationLibrary"; + public static final String TYPE_INFO_DEFAULT_IMPLS = "typeInfoDefaultImpls"; + public static final String TYPE_INFO_DEFAULT_IMPLS_DESC = "Map of schema name to default Jackson deserialization class for @JsonTypeInfo(defaultImpl=...). Applies to both deduction-based and discriminator-based oneOf interfaces. Overrides x-jackson-default-impl when both are set for the same schema. Example: yaml `typeInfoDefaultImpls: {PostRegistrationRequest: PostRegistrationBasicRequest}`"; + public static final String API_NAME_PREFIX = "apiNamePrefix"; public static final String API_NAME_PREFIX_DESC = "Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet."; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java index 5aa24940cb6a..ffa778435173 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java @@ -33,6 +33,7 @@ public enum VendorExtension { X_MINIMUM_MESSAGE("x-minimum-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the minimum value of a variable", null), X_MAXIMUM_MESSAGE("x-maximum-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the maximum value of a variable", null), X_ZERO_BASED_ENUM("x-zero-based-enum", ExtensionLevel.MODEL, "When used on an enum, the index will not be generated and the default numbering will be used, zero-based", "false"), + X_JACKSON_DEFAULT_IMPL("x-jackson-default-impl", ExtensionLevel.MODEL, "Specifies the default implementation class name for Jackson @JsonTypeInfo(defaultImpl=...) on a oneOf interface schema (deduction-based or discriminator-based). Can be overridden per-schema by the `typeInfoDefaultImpls` generator option.", null), X_JACKSON_JSON_INCLUDE_POLICY("x-jackson-json-include-policy", ExtensionLevel.FIELD, "Manually override the resolved Jackson `@JsonInclude` policy for this property. Must be one of `ALWAYS`, `NON_NULL`, `NON_ABSENT`, `NON_EMPTY`, `NON_DEFAULT`, `USE_DEFAULTS`, `CUSTOM`, or `NONE` to emit no annotation. Always wins over the automatic required/nullable matrix and the `optionalNonNullPropertyJsonInclude` option.", "resolved automatically per the required/nullable matrix"), X_JACKSON_JSON_SETTER_NULLS("x-jackson-json-setter-nulls", ExtensionLevel.FIELD, "Manually override the resolved Jackson `@JsonSetter(nulls = ...)` deserialization null-handling for this property. Must be one of `SKIP` (ignore an explicit JSON null, keeping the default), `FAIL` (reject an explicit JSON null), or `NONE` to emit no annotation. Always wins over the automatic `openApiNullable` default and the `optionalNonNullPropertyJsonSetterNulls` option, and is honored regardless of `generateJsonSetterNullsAnnotations` or whether the property is required/nullable.", "resolved automatically per the openApiNullable default"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 554f98183fc7..c34e5bf9f48c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -57,7 +57,6 @@ import org.slf4j.LoggerFactory; import javax.lang.model.SourceVersion; - import java.io.File; import java.io.IOException; import java.io.Writer; @@ -230,6 +229,8 @@ protected enum ENUM_PROPERTY_NAMING_TYPE {MACRO_CASE, legacy, original} @Getter @Setter protected boolean useDeductionForOneOfInterfaces = false; + protected Map typeInfoDefaultImpls = new HashMap<>(); + private Map schemaKeyToModelNameCache = new HashMap<>(); public AbstractJavaCodegen() { @@ -749,6 +750,26 @@ public Map postProcessAllModels(Map objs) } } + // Resolve x-jackson-default-impl and typeInfoDefaultImpls into x-jackson-resolved-default-impl + // on each model. This drives defaultImpl = ... in @JsonTypeInfo for both deduction-based + // and discriminator-based oneOf interfaces. + if (!typeInfoDefaultImpls.isEmpty() || allModels.values().stream() + .anyMatch(cm -> cm.vendorExtensions.containsKey(VendorExtension.X_JACKSON_DEFAULT_IMPL.getName()))) { + for (CodegenModel cm : allModels.values()) { + String resolved = JacksonDefaultImplResolver.resolve( + typeInfoDefaultImpls, cm, this::toModelName, allModels.keySet(), LOGGER::warn); + if (resolved != null && !resolved.isBlank()) { + cm.vendorExtensions.put(JacksonDefaultImplResolver.RESOLVED_DEFAULT_IMPL, resolved); + // When a discriminator is present, the typeInfoAnnotation partial is rendered + // inside {{#discriminator}}, so the template engine resolves 'vendorExtensions' + // against CodegenDiscriminator (not CodegenModel). Store there too. + if (cm.discriminator != null) { + cm.discriminator.getVendorExtensions().put(JacksonDefaultImplResolver.RESOLVED_DEFAULT_IMPL, resolved); + } + } + } + } + /* Add parentVars and parentRequiredVars to every Model which has a parent. Add isInherited to every model which has children. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JacksonDefaultImplResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JacksonDefaultImplResolver.java new file mode 100644 index 000000000000..7de1d8e29994 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JacksonDefaultImplResolver.java @@ -0,0 +1,100 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * 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. + */ + +package org.openapitools.codegen.languages; + +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.VendorExtension; + +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; +import java.util.function.Function; + +/** + * Shared resolution of the Jackson {@code defaultImpl} for oneOf interfaces. + * + *

The default implementation can be provided either per-schema via the + * {@code x-jackson-default-impl} vendor extension, or via the {@code typeInfoDefaultImpls} + * generator option (keyed by schema name). The config option takes precedence over the + * vendor extension. + * + *

This logic is shared by {@link AbstractJavaCodegen}, {@link KotlinClientCodegen} and + * {@link KotlinSpringServerCodegen}. The latter two are siblings under + * {@code AbstractKotlinCodegen}, so the copy cannot be shared through inheritance; keeping it in + * one place avoids the three implementations silently drifting apart. + */ +final class JacksonDefaultImplResolver { + + static final String RESOLVED_DEFAULT_IMPL = "x-jackson-resolved-default-impl"; + + private JacksonDefaultImplResolver() { + } + + /** + * Resolve the {@code defaultImpl} class reference for the given model, if any. + * + * @param typeInfoDefaultImpls the {@code typeInfoDefaultImpls} config map (schema name to class) + * @param cm the model being processed + * @param toModelName the generator's schema-name to model-name mapping + * @param knownModelNames the set of generated model names in this spec + * @param warn sink for warning messages + * @return the class reference to emit as {@code defaultImpl} (a generated model name, an external + * simple class name, or {@code null} when nothing is configured) + */ + static String resolve(Map typeInfoDefaultImpls, + CodegenModel cm, + Function toModelName, + Set knownModelNames, + Consumer warn) { + Object rawAnnotationExt = cm.vendorExtensions.get(VendorExtension.X_JACKSON_DEFAULT_IMPL.getName()); + String schemaAnnotation = rawAnnotationExt instanceof String ? (String) rawAnnotationExt : null; + String configValue = typeInfoDefaultImpls == null ? null : typeInfoDefaultImpls.get(cm.schemaName); + + String rawValue; + if (configValue != null && !configValue.isBlank()) { + if (schemaAnnotation != null && !schemaAnnotation.isBlank()) { + warn.accept(String.format(Locale.ROOT, "typeInfoDefaultImpls overrides x-jackson-default-impl on schema '%s': '%s' \u2192 '%s'", + cm.schemaName, schemaAnnotation, configValue)); + } + rawValue = configValue; + } else if (schemaAnnotation != null && !schemaAnnotation.isBlank()) { + rawValue = schemaAnnotation; + } else { + return null; + } + + String resolvedModelName = toModelName.apply(rawValue); + if (resolvedModelName != null && knownModelNames.contains(resolvedModelName)) { + // A generated model in this spec: its import is already contributed by the oneOf + // interface (mappedModels / interfaceModels), so only the class name is needed. + return resolvedModelName; + } + + // Not a generated model: this is a valid external or catch-all class. Preserve the name + // verbatim instead of running it through toModelName (which would mangle a qualified name), + // and register the import when it is fully qualified so the reference resolves. + warn.accept(String.format(Locale.ROOT, "x-jackson-default-impl / typeInfoDefaultImpls on schema '%s' refers to '%s' which is not a known model in this spec. " + + "This is valid for external or catch-all classes, but may indicate a typo.", cm.schemaName, rawValue)); + int lastDot = rawValue.lastIndexOf('.'); + if (lastDot > 0 && lastDot < rawValue.length() - 1) { + cm.imports.add(rawValue); + return rawValue.substring(lastDot + 1); + } + return rawValue; + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 6f6cb0af8471..b16ac7112ac7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -291,6 +291,7 @@ public JavaClientCodegen() { cliOptions.add(CliOption.newBoolean(USE_UNARY_INTERCEPTOR, "If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption", this.useUnaryInterceptor)); cliOptions.add(CliOption.newBoolean(USE_JSPECIFY, "Use Jspecify for null checks. Only supported for " + JSPECIFY_SUPPORTED_LIBRARIES, useJspecify)); cliOptions.add(CliOption.newBoolean(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, USE_DEDUCTION_FOR_ONE_OF_INTERFACES_DESC, useDeductionForOneOfInterfaces)); + cliOptions.add(new CliOption(TYPE_INFO_DEFAULT_IMPLS, TYPE_INFO_DEFAULT_IMPLS_DESC).defaultValue("empty map")); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.18.9"); supportedLibraries.put(JERSEY3, "HTTP client: Jersey client 3.1.11. JSON processing: Jackson 2.x (3.x if `useJackson3=true`, requires Java 17+)"); @@ -382,6 +383,10 @@ public void processOpts() { super.processOpts(); // can actually change the library (possibly only in unit-tests but still...) + if (additionalProperties.containsKey(TYPE_INFO_DEFAULT_IMPLS)) { + typeInfoDefaultImpls.putAll(getPropertyAsStringMap(TYPE_INFO_DEFAULT_IMPLS)); + } + // determine and cache client library type once final boolean libApache = isLibrary(APACHE); final boolean libFeign = isLibrary(FEIGN) || isLibrary(FEIGN_HC5); @@ -1401,6 +1406,7 @@ public void addImportsToOneOfInterface(List> imports) { public List getSupportedVendorExtensions() { List extensions = super.getSupportedVendorExtensions(); extensions.add(VendorExtension.X_WEBCLIENT_BLOCKING); + extensions.add(VendorExtension.X_JACKSON_DEFAULT_IMPL); return extensions; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicroprofileServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicroprofileServerCodegen.java index 0703d0b2cdd8..0189e3660940 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicroprofileServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicroprofileServerCodegen.java @@ -1,14 +1,20 @@ package org.openapitools.codegen.languages; +import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenResponse; import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.VendorExtension; import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; import java.io.File; import java.util.List; +import java.util.Map; + +import static org.openapitools.codegen.CodegenConstants.TYPE_INFO_DEFAULT_IMPLS; public class JavaMicroprofileServerCodegen extends JavaClientCodegen { public static final String PROJECT_NAME = "projectName"; @@ -24,6 +30,11 @@ public JavaMicroprofileServerCodegen() { apiPackage = "org.openapitools.server.api"; modelPackage = "org.openapitools.server.model"; setLibrary("microprofile"); + + // The microprofile library renders oneOf interfaces through its own model.mustache, but does + // not support Jackson's @JsonTypeInfo(defaultImpl = ...) on them, so typeInfoDefaultImpls and + // x-jackson-default-impl have no meaningful effect here. + cliOptions.removeIf(opt -> TYPE_INFO_DEFAULT_IMPLS.equals(opt.getOpt())); } @Override @@ -45,6 +56,27 @@ public String getHelp() { public void processOpts() { super.processOpts(); additionalProperties.put(MICROPROFILE_SERVER, microprofileServer); + // Clear any typeInfoDefaultImpls that the parent may have read; the microprofile + // model template does not support Jackson defaultImpl on oneOf interfaces. + typeInfoDefaultImpls.clear(); + } + + @Override + public Map postProcessAllModels(Map objs) { + // The inherited resolution in AbstractJavaCodegen would otherwise turn a schema-level + // x-jackson-default-impl into a defaultImpl = ... annotation, which the microprofile + // templates do not support. Strip the opt-in extension before that resolution runs. + for (CodegenModel cm : getAllModels(objs).values()) { + cm.vendorExtensions.remove(VendorExtension.X_JACKSON_DEFAULT_IMPL.getName()); + } + return super.postProcessAllModels(objs); + } + + @Override + public List getSupportedVendorExtensions() { + List extensions = super.getSupportedVendorExtensions(); + extensions.remove(VendorExtension.X_JACKSON_DEFAULT_IMPL); + return extensions; } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index 00e523fd449f..93f7f508177c 100755 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -132,6 +132,8 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen { @Getter @Setter protected boolean failOnUnknownProperties = false; @Setter protected boolean companionObject = false; + protected Map typeInfoDefaultImpls = new HashMap<>(); + protected String authFolder; @Getter protected SERIALIZATION_LIBRARY_TYPE serializationLibrary = SERIALIZATION_LIBRARY_TYPE.moshi; @@ -296,6 +298,14 @@ public KotlinClientCodegen() { cliOptions.add(new CliOption(MAP_FILE_BINARY_TO_BYTE_ARRAY, "Map File and Binary to ByteArray (default: false)").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newBoolean(GENERATE_ONEOF_ANYOF_WRAPPERS, "Generate oneOf, anyOf schemas as wrappers. Only `jvm-retrofit2`(library) with `gson` or `kotlinx_serialization`(serializationLibrary) support this option.")); + cliOptions.add(new CliOption(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS, + "Map of schema name to default Jackson deserialization class for @JsonTypeInfo(defaultImpl=...). " + + "For kotlin-client this applies to discriminator-based oneOf interfaces only " + + "(deduction-based oneOf is not supported by the kotlin-client templates). " + + "Overrides x-jackson-default-impl when both are set for the same schema. " + + "Requires the jackson serialization library. " + + "Example: yaml `typeInfoDefaultImpls: {PostRegistrationRequest: PostRegistrationBasicRequest}`") + .defaultValue("empty map")); cliOptions.add(CliOption.newBoolean(COMPANION_OBJECT, "Whether to generate companion objects in data classes, enabling companion extensions.", false)); @@ -518,6 +528,10 @@ public void processOpts() { setGenerateOneOfAnyOfWrappers(convertPropertyToBooleanAndWriteBack(GENERATE_ONEOF_ANYOF_WRAPPERS)); } + if (additionalProperties.containsKey(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS)) { + typeInfoDefaultImpls.putAll(getPropertyAsStringMap(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS)); + } + if (additionalProperties.containsKey(FAIL_ON_UNKNOWN_PROPERTIES)) { setFailOnUnknownProperties(convertPropertyToBooleanAndWriteBack(FAIL_ON_UNKNOWN_PROPERTIES)); } else { @@ -1012,6 +1026,26 @@ public ModelsMap postProcessModels(ModelsMap objs) { @Override public Map postProcessAllModels(Map objs) { objs = super.postProcessAllModels(objs); + + // Resolve x-jackson-default-impl / typeInfoDefaultImpls into x-jackson-resolved-default-impl. + // kotlin-client only supports discriminator-based oneOf (via @JsonTypeInfo + @JsonSubTypes); + // deduction-based is not supported by these templates. + if (getSerializationLibrary() == SERIALIZATION_LIBRARY_TYPE.jackson) { + Map allModelsMap = getAllModels(objs); + for (CodegenModel cm : allModelsMap.values()) { + if (cm.discriminator == null) { + continue; + } + String resolved = JacksonDefaultImplResolver.resolve( + typeInfoDefaultImpls, cm, this::toModelName, allModelsMap.keySet(), LOGGER::warn); + if (resolved != null && !resolved.isBlank()) { + // typeInfoAnnotation.mustache is rendered inside {{#discriminator}}, + // so JMustache resolves 'vendorExtensions' against CodegenDiscriminator. + cm.discriminator.getVendorExtensions().put(JacksonDefaultImplResolver.RESOLVED_DEFAULT_IMPL, resolved); + } + } + } + if (getSerializationLibrary() == SERIALIZATION_LIBRARY_TYPE.kotlinx_serialization || getLibrary().equals(MULTIPLATFORM)) { // The loop removes unneeded variables so commas are handled correctly in the related templates for (Map.Entry modelsMap : objs.entrySet()) { @@ -1280,6 +1314,7 @@ public List getSupportedVendorExtensions() { var extensions = super.getSupportedVendorExtensions(); extensions.add(VendorExtension.X_CLASS_EXTRA_ANNOTATION); extensions.add(VendorExtension.X_FIELD_EXTRA_ANNOTATION); + extensions.add(VendorExtension.X_JACKSON_DEFAULT_IMPL); return extensions; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index d2c9e61a130b..73515b575492 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -193,6 +193,8 @@ public enum RequestMappingMode { @Getter @Setter protected boolean useDeductionForOneOfInterfaces = false; + private Map typeInfoDefaultImpls = new HashMap<>(); + @Getter @Setter protected boolean useSpringBoot3 = false; @Getter @Setter @@ -347,6 +349,7 @@ public KotlinSpringServerCodegen() { + "deserialization null-handling defers to the global ObjectMapper. When left unset it defaults to " + "false (7.23.0-equivalent output) and logs a warning; set it explicitly to silence the warning.", false); cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES_DESC, useDeductionForOneOfInterfaces)); + addOption(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS, CodegenConstants.TYPE_INFO_DEFAULT_IMPLS_DESC, "empty map"); addSwitch(CodegenConstants.USE_ENUM_VALUE_INTERFACE, CodegenConstants.USE_ENUM_VALUE_INTERFACE_DESC, useEnumValueInterface); addSwitch(CodegenConstants.OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library (jackson-databind-nullable) for strict null handling. " @@ -631,6 +634,10 @@ public void processOpts() { convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, this::setUseDeductionForOneOfInterfaces); + if (additionalProperties.containsKey(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS)) { + typeInfoDefaultImpls.putAll(getPropertyAsStringMap(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS)); + } + additionalProperties.put("springHttpStatus", new SpringHttpStatusLambda()); // Set basePackage from invokerPackage @@ -1471,6 +1478,23 @@ public Map postProcessAllModels(Map objs) Map allModelsMap = getAllModels(objs); + // Resolve x-jackson-default-impl and typeInfoDefaultImpls into x-jackson-resolved-default-impl + // on each model. This drives defaultImpl = ... in @JsonTypeInfo for both deduction-based + // and discriminator-based oneOf interfaces. + for (CodegenModel cm : allModelsMap.values()) { + String resolved = JacksonDefaultImplResolver.resolve( + typeInfoDefaultImpls, cm, this::toModelName, allModelsMap.keySet(), LOGGER::warn); + if (resolved != null && !resolved.isBlank()) { + cm.vendorExtensions.put(JacksonDefaultImplResolver.RESOLVED_DEFAULT_IMPL, resolved); + // When a discriminator is present, the typeInfoAnnotation partial is rendered + // inside {{#discriminator}}, so JMustache resolves 'vendorExtensions' against + // CodegenDiscriminator (not CodegenModel). Store there too. + if (cm.discriminator != null) { + cm.discriminator.getVendorExtensions().put(JacksonDefaultImplResolver.RESOLVED_DEFAULT_IMPL, resolved); + } + } + } + // For each oneOf interface with a discriminator, mark the discriminator property // as inherited in each subtype and set its default value from the discriminator mapping for (CodegenModel cm : allModelsMap.values()) { @@ -1936,6 +1960,7 @@ public List getSupportedVendorExtensions() { extensions.add(VendorExtension.X_CONTENT_TYPE); extensions.add(VendorExtension.X_DISCRIMINATOR_VALUE); extensions.add(VendorExtension.X_FIELD_EXTRA_ANNOTATION); + extensions.add(VendorExtension.X_JACKSON_DEFAULT_IMPL); extensions.add(VendorExtension.X_OPERATION_EXTRA_ANNOTATION); extensions.add(VendorExtension.X_EXTRA_IMPORTS); extensions.add(VendorExtension.X_PATTERN_MESSAGE); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 8c76f4913cf3..1dafd610a612 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -376,6 +376,7 @@ public SpringCodegen() { optionalAcceptNullable)); cliOptions.add(CliOption.newBoolean(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, USE_DEDUCTION_FOR_ONE_OF_INTERFACES_DESC, useDeductionForOneOfInterfaces)); + cliOptions.add(new CliOption(TYPE_INFO_DEFAULT_IMPLS, TYPE_INFO_DEFAULT_IMPLS_DESC).defaultValue("empty map")); cliOptions.add(CliOption.newString(SPRING_API_VERSION, "Value for 'version' attribute in @RequestMapping (for Spring 7 and above).")); cliOptions.add(CliOption.newString(USE_HTTP_SERVICE_PROXY_FACTORY_INTERFACES_CONFIGURATOR, "Generate HttpInterfacesAbstractConfigurator based on an HttpServiceProxyFactory instance (as opposed to a WebClient instance, when disabled) for generating Spring HTTP interfaces.") @@ -511,6 +512,10 @@ public void processOpts() { // Please refrain from updating values of Config Options after super.ProcessOpts() is called super.processOpts(); + if (additionalProperties.containsKey(TYPE_INFO_DEFAULT_IMPLS)) { + typeInfoDefaultImpls.putAll(getPropertyAsStringMap(TYPE_INFO_DEFAULT_IMPLS)); + } + if (SPRING_HTTP_INTERFACE.equals(library)) { if (documentationProvider != null) { additionalProperties.remove(documentationProvider.getPropertyName()); @@ -631,6 +636,7 @@ public void processOpts() { convertPropertyToBooleanAndWriteBack(OPTIONAL_ACCEPT_NULLABLE, this::setOptionalAcceptNullable); convertPropertyToBooleanAndWriteBack(USE_SPRING_BUILT_IN_VALIDATION, this::setUseSpringBuiltInValidation); convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, this::setUseDeductionForOneOfInterfaces); + convertPropertyToStringAndWriteBack(CLIENT_REGISTRATION_ID, this::setClientRegistrationId); convertPropertyToBooleanAndWriteBack(USE_SPRING_SECURITY_PRE_AUTHORIZE, this::setUseSpringSecurityPreAuthorize); convertPropertyToStringAndWriteBack(SPRING_SECURITY_AUTHORITY_PREFIX, this::setSpringSecurityAuthorityPrefix); @@ -1601,6 +1607,7 @@ public Map postProcessAllModels(Map objs) objs = super.postProcessAllModels(objs); Map allModels = getAllModels(objs); + // conditionally force the generation of no args constructor for (CodegenModel cm : allModels.values()) { boolean hasLombokNoArgsConstructor = lombokAnnotations != null && lombokAnnotations.containsKey("NoArgsConstructor"); @@ -1716,6 +1723,7 @@ public List getSupportedVendorExtensions() { extensions.add(VendorExtension.X_MINIMUM_MESSAGE); extensions.add(VendorExtension.X_MAXIMUM_MESSAGE); extensions.add(VendorExtension.X_SPRING_API_VERSION); + extensions.add(VendorExtension.X_JACKSON_DEFAULT_IMPL); extensions.add(VendorExtension.X_JACKSON_JSON_INCLUDE_POLICY); extensions.add(VendorExtension.X_JACKSON_JSON_SETTER_NULLS); return extensions; diff --git a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache index 27fb0af3b472..a673f0feaf8e 100644 --- a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache @@ -18,6 +18,26 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.3" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + jakarta_annotation_version = "1.3.5" + {{#useBeanValidation}} + bean_validation_version = "3.0.2" + {{/useBeanValidation}} + jersey_version = "1.19.4" + jodatime_version = "2.9.9" + junit_version = "5.10.2" + {{#useReflectionEqualsHashCode}} + commons_lang3_version = "3.17.0" + {{/useReflectionEqualsHashCode}} +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -114,26 +134,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.3" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" - {{#useBeanValidation}} - bean_validation_version = "3.0.2" - {{/useBeanValidation}} - jersey_version = "1.19.4" - jodatime_version = "2.9.9" - junit_version = "5.10.2" - {{#useReflectionEqualsHashCode}} - commons_lang3_version = "3.17.0" - {{/useReflectionEqualsHashCode}} -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/modules/openapi-generator/src/main/resources/Java/deductionAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/deductionAnnotation.mustache index c59bc4cbfd17..0bcd6cdbd769 100644 --- a/modules/openapi-generator/src/main/resources/Java/deductionAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/Java/deductionAnnotation.mustache @@ -1,12 +1,13 @@ {{^discriminator}} {{#jackson}} {{#useDeductionForOneOfInterfaces}} - @JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) - @JsonSubTypes({ - {{#interfaceModels}} - @JsonSubTypes.Type(value = {{classname}}.class){{^-last}}, {{/-last}} - {{/interfaceModels}} - }) + +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION{{#vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{vendorExtensions.x-jackson-resolved-default-impl}}.class{{/vendorExtensions.x-jackson-resolved-default-impl}}) +@JsonSubTypes({ +{{#interfaceModels}} + @JsonSubTypes.Type(value = {{classname}}.class){{^-last}}, {{/-last}} +{{/interfaceModels}} +}) {{/useDeductionForOneOfInterfaces}} {{/jackson}} {{/discriminator}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache index f7374e37e164..b9001d7dabb5 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache @@ -18,6 +18,29 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.6" + {{^useJackson3}} + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + {{/useJackson3}} + {{#useJackson3}} + jackson3_version = "3.1.5" + jackson_annotations_version = "2.21" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + {{/useJackson3}} + jakarta_annotation_version = "1.3.5" + httpclient_version = "5.6.3" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -124,29 +147,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.6" - {{^useJackson3}} - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - {{/useJackson3}} - {{#useJackson3}} - jackson3_version = "3.1.5" - jackson_annotations_version = "2.21" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - {{/useJackson3}} - jakarta_annotation_version = "1.3.5" - httpclient_version = "5.6.3" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache index 59a3ef4d574f..57f19dcf15ee 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -19,6 +19,26 @@ repositories { } +ext { + swagger_annotations_version = "1.6.11" + {{#jackson}} + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + {{/jackson}} + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + jakarta_annotation_version = "1.3.5" + feign_version = "13.5" + feign_form_version = "3.8.0" + junit_version = "5.7.0" + scribejava_version = "8.0.0" + {{#useReflectionEqualsHashCode}} + commons_lang3_version = "3.17.0" + {{/useReflectionEqualsHashCode}} +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -102,26 +122,6 @@ test { useJUnitPlatform() } -ext { - swagger_annotations_version = "1.6.11" - {{#jackson}} - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - {{/jackson}} - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" - feign_version = "13.5" - feign_form_version = "3.8.0" - junit_version = "5.7.0" - scribejava_version = "8.0.0" - {{#useReflectionEqualsHashCode}} - commons_lang3_version = "3.17.0" - {{/useReflectionEqualsHashCode}} -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache index e56d1880a19b..46a040d8e447 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache @@ -19,6 +19,21 @@ repositories { } +ext { + swagger_annotations_version = "1.6.3" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + jakarta_annotation_version = "1.3.5" + google_api_client_version = "1.32.2" + jersey_common_version = "2.25.1" + jodatime_version = "2.9.9" + junit_version = "4.13.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,21 +113,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.3" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" - google_api_client_version = "1.32.2" - jersey_common_version = "2.25.1" - jodatime_version = "2.9.9" - junit_version = "4.13.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index e5f80094dd6c..43d5f692a616 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -20,6 +20,36 @@ repositories { mavenCentral() } +ext { + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.6" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.15" + {{/swagger2AnnotationLibrary}} + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + jakarta_annotation_version = "1.3.5" + {{#useBeanValidation}} + bean_validation_version = "3.0.2" + {{/useBeanValidation}} + jersey_version = "2.35" + junit_version = "5.8.2" + {{#hasOAuthMethods}} + scribejava_apis_version = "8.3.1" + {{/hasOAuthMethods}} + {{#hasHttpSignatureMethods}} + tomitribe_http_signatures_version = "1.7" + {{/hasHttpSignatureMethods}} + {{#useReflectionEqualsHashCode}} + commons_lang3_version = "3.17.0" + {{/useReflectionEqualsHashCode}} +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,36 +129,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - {{#swagger1AnnotationLibrary}} - swagger_annotations_version = "1.6.6" - {{/swagger1AnnotationLibrary}} - {{#swagger2AnnotationLibrary}} - swagger_annotations_version = "2.2.15" - {{/swagger2AnnotationLibrary}} - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" - {{#useBeanValidation}} - bean_validation_version = "3.0.2" - {{/useBeanValidation}} - jersey_version = "2.35" - junit_version = "5.8.2" - {{#hasOAuthMethods}} - scribejava_apis_version = "8.3.1" - {{/hasOAuthMethods}} - {{#hasHttpSignatureMethods}} - tomitribe_http_signatures_version = "1.7" - {{/hasHttpSignatureMethods}} - {{#useReflectionEqualsHashCode}} - commons_lang3_version = "3.17.0" - {{/useReflectionEqualsHashCode}} -} - dependencies { {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache index 7a364355f431..935b08e4c754 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache @@ -20,6 +20,37 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.5" + {{^useJackson3}} + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + {{/useJackson3}} + {{#useJackson3}} + jackson3_version = "3.1.5" + jackson_annotations_version = "2.21" + {{/useJackson3}} + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + jakarta_annotation_version = "3.0.0" + {{#useBeanValidation}} + bean_validation_version = "3.1.1" + {{/useBeanValidation}} + jersey_version = "3.0.4" + junit_version = "5.8.2" + {{#hasOAuthMethods}} + scribejava_apis_version = "8.3.1" + {{/hasOAuthMethods}} + {{#hasHttpSignatureMethods}} + tomitribe_http_signatures_version = "1.7" + {{/hasHttpSignatureMethods}} + {{#useReflectionEqualsHashCode}} + commons_lang3_version = "3.17.0" + {{/useReflectionEqualsHashCode}} +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,37 +130,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.5" - {{^useJackson3}} - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - {{/useJackson3}} - {{#useJackson3}} - jackson3_version = "3.1.5" - jackson_annotations_version = "2.21" - {{/useJackson3}} - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - jakarta_annotation_version = "3.0.0" - {{#useBeanValidation}} - bean_validation_version = "3.1.1" - {{/useBeanValidation}} - jersey_version = "3.0.4" - junit_version = "5.8.2" - {{#hasOAuthMethods}} - scribejava_apis_version = "8.3.1" - {{/hasOAuthMethods}} - {{#hasHttpSignatureMethods}} - tomitribe_http_signatures_version = "1.7" - {{/hasHttpSignatureMethods}} - {{#useReflectionEqualsHashCode}} - commons_lang3_version = "3.17.0" - {{/useReflectionEqualsHashCode}} -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache index 1b440bd4d3b0..e45ece4322f3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache @@ -28,6 +28,19 @@ sourceSets { } {{/sourceFolder}} +ext { + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.9" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.9" + {{/swagger2AnnotationLibrary}} + jakarta_annotation_version = "1.3.5" + {{#useBeanValidation}} + bean_validation_version = "2.0.2" + {{/useBeanValidation}} +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -107,19 +120,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - {{#swagger1AnnotationLibrary}} - swagger_annotations_version = "1.6.9" - {{/swagger1AnnotationLibrary}} - {{#swagger2AnnotationLibrary}} - swagger_annotations_version = "2.2.9" - {{/swagger2AnnotationLibrary}} - jakarta_annotation_version = "1.3.5" - {{#useBeanValidation}} - bean_validation_version = "2.0.2" - {{/useBeanValidation}} -} - dependencies { {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache index d7d32032b0c0..4d62ff66aef5 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache @@ -19,6 +19,33 @@ repositories { } +ext { + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.16" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.36" + {{/swagger2AnnotationLibrary}} + rest_assured_version = "5.5.6" + junit_version = "5.10.3" +{{#jackson}} + jackson_version = "2.21.5" + jackson_databind_version = "2.21.5" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} +{{/jackson}} +{{#gson}} + gson_version = "2.10.1" + gson_fire_version = "1.9.0" +{{/gson}} +{{#joda}} + jodatime_version = "2.10.5" +{{/joda}} + okio_version = "3.6.0" + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,33 +125,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - {{#swagger1AnnotationLibrary}} - swagger_annotations_version = "1.6.16" - {{/swagger1AnnotationLibrary}} - {{#swagger2AnnotationLibrary}} - swagger_annotations_version = "2.2.36" - {{/swagger2AnnotationLibrary}} - rest_assured_version = "5.5.6" - junit_version = "5.10.3" -{{#jackson}} - jackson_version = "2.21.5" - jackson_databind_version = "2.21.5" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} -{{/jackson}} -{{#gson}} - gson_version = "2.10.1" - gson_fire_version = "1.9.0" -{{/gson}} -{{#joda}} - jodatime_version = "2.10.5" -{{/joda}} - okio_version = "3.6.0" - jakarta_annotation_version = "1.3.5" -} - dependencies { {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/build.gradle.mustache index 69e7296add2b..92639f2d884d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/build.gradle.mustache @@ -19,6 +19,36 @@ repositories { } +ext { + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.16" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.43" + {{/swagger2AnnotationLibrary}} + {{#useJackson3}} + jackson_version = "3.1.5" + {{/useJackson3}} + {{^useJackson3}} + jackson_version = "2.21.5" + {{/useJackson3}} + jackson_annotations_version = "2.21" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + {{^useSpringBoot4}} + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + {{/useSpringBoot4}} + {{#useSpringBoot4}} + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + {{/useSpringBoot4}} + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,36 +128,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - {{#swagger1AnnotationLibrary}} - swagger_annotations_version = "1.6.16" - {{/swagger1AnnotationLibrary}} - {{#swagger2AnnotationLibrary}} - swagger_annotations_version = "2.2.43" - {{/swagger2AnnotationLibrary}} - {{#useJackson3}} - jackson_version = "3.1.5" - {{/useJackson3}} - {{^useJackson3}} - jackson_version = "2.21.5" - {{/useJackson3}} - jackson_annotations_version = "2.21" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - {{^useSpringBoot4}} - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - {{/useSpringBoot4}} - {{#useSpringBoot4}} - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - {{/useSpringBoot4}} - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache index ce34755e8145..139d8c110fbb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache @@ -19,6 +19,20 @@ repositories { } +ext { + swagger_annotations_version = "1.6.3" + jackson_version = "2.21.5" + jackson_databind_version = "2.21.5" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + jakarta_annotation_version = "1.3.5" + threetenbp_version = "2.9.10" + resteasy_version = "4.5.11.Final" + assertj_version = "3.23.1" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,20 +112,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.3" - jackson_version = "2.21.5" - jackson_databind_version = "2.21.5" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" - threetenbp_version = "2.9.10" - resteasy_version = "4.5.11.Final" - assertj_version = "3.23.1" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache index 0b304e354868..f7a63dd90734 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache @@ -19,6 +19,44 @@ repositories { } +ext { + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.9" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.9" + {{/swagger2AnnotationLibrary}} + {{#useJackson3}} + jackson_version = "3.1.5" + {{/useJackson3}} + {{^useJackson3}} + jackson_version = "2.21.5" + {{/useJackson3}} + jackson_annotations_version = "2.21" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + {{#useSpringBoot4}} + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + {{/useSpringBoot4}} + {{^useSpringBoot4}} + {{#useJakartaEe}} + spring_web_version = "6.2.8" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.0.2" + {{/useJakartaEe}} + {{^useJakartaEe}} + spring_web_version = "5.3.33" + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + {{/useJakartaEe}} + {{/useSpringBoot4}} + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -110,44 +148,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - {{#swagger1AnnotationLibrary}} - swagger_annotations_version = "1.6.9" - {{/swagger1AnnotationLibrary}} - {{#swagger2AnnotationLibrary}} - swagger_annotations_version = "2.2.9" - {{/swagger2AnnotationLibrary}} - {{#useJackson3}} - jackson_version = "3.1.5" - {{/useJackson3}} - {{^useJackson3}} - jackson_version = "2.21.5" - {{/useJackson3}} - jackson_annotations_version = "2.21" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - {{#useSpringBoot4}} - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - {{/useSpringBoot4}} - {{^useSpringBoot4}} - {{#useJakartaEe}} - spring_web_version = "6.2.8" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.0.2" - {{/useJakartaEe}} - {{^useJakartaEe}} - spring_web_version = "5.3.33" - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" - {{/useJakartaEe}} - {{/useSpringBoot4}} - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index a8d08435b53e..3a1e6d84e2ca 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -19,6 +19,36 @@ repositories { } +ext { + oltu_version = "1.0.1" + retrofit_version = "2.11.0" + {{#jackson}} + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + javax_ws_rs_api_version = "2.1.1" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + {{/jackson}} + {{#usePlayWS}} + play_version = "2.6.7" + {{/usePlayWS}} + jakarta_annotation_version = "1.3.5" + swagger_annotations_version = "1.5.22" + junit_version = "5.10.3" + {{#useRxJava2}} + rx_java_version = "2.1.1" + {{/useRxJava2}} + {{#useRxJava3}} + rx_java_version = "3.0.4" + {{/useRxJava3}} + {{#joda}} + jodatime_version = "2.9.9" + {{/joda}} + json_fire_version = "1.9.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,36 +128,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - oltu_version = "1.0.1" - retrofit_version = "2.11.0" - {{#jackson}} - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - javax_ws_rs_api_version = "2.1.1" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - {{/jackson}} - {{#usePlayWS}} - play_version = "2.6.7" - {{/usePlayWS}} - jakarta_annotation_version = "1.3.5" - swagger_annotations_version = "1.5.22" - junit_version = "5.10.3" - {{#useRxJava2}} - rx_java_version = "2.1.1" - {{/useRxJava2}} - {{#useRxJava3}} - rx_java_version = "3.0.4" - {{/useRxJava3}} - {{#joda}} - jodatime_version = "2.9.9" - {{/joda}} - json_fire_version = "1.9.0" -} - dependencies { implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache index 2812d002ced8..29b8e3bd94ab 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache @@ -18,6 +18,48 @@ repositories { mavenCentral() } +ext { + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.16" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.43" + {{/swagger2AnnotationLibrary}} + {{#useJakartaEe}} + {{^useSpringBoot4}} + spring_boot_version = "3.5.11" + {{/useSpringBoot4}} + {{#useSpringBoot4}} + spring_boot_version = "4.0.3" + {{/useSpringBoot4}} + jakarta_annotation_version = "3.0.0" + beanvalidation_version = "3.0.2" + reactor_version = "3.5.12" + reactor_netty_version = "1.2.8" + {{/useJakartaEe}} + {{^useJakartaEe}} + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + reactor_version = "3.4.34" + reactor_netty_version = "1.2.8" + {{/useJakartaEe}} + {{#useJackson3}} + jackson_version = "3.1.5" + {{/useJackson3}} + {{^useJackson3}} + jackson_version = "2.21.5" + {{/useJackson3}} + jackson_annotations_version = "2.21" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.11" + {{/openApiNullable}} + {{#joda}} + jodatime_version = "2.14.0" + {{/joda}} + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -125,53 +167,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - {{#swagger1AnnotationLibrary}} - swagger_annotations_version = "1.6.16" - {{/swagger1AnnotationLibrary}} - {{#swagger2AnnotationLibrary}} - swagger_annotations_version = "2.2.43" - {{/swagger2AnnotationLibrary}} - {{#useJakartaEe}} - {{^useSpringBoot4}} - spring_boot_version = "3.5.11" - {{/useSpringBoot4}} - {{#useSpringBoot4}} - spring_boot_version = "4.0.3" - {{/useSpringBoot4}} - jakarta_annotation_version = "3.0.0" - beanvalidation_version = "3.0.2" - reactor_version = "3.5.12" - reactor_netty_version = "1.2.8" - {{/useJakartaEe}} - {{^useJakartaEe}} - spring_boot_version = "2.7.17" - jakarta_annotation_version = "1.3.5" - beanvalidation_version = "2.0.2" - reactor_version = "3.4.34" - reactor_netty_version = "1.2.8" - {{/useJakartaEe}} - {{#useJackson3}} - jackson_version = "3.1.5" - {{/useJackson3}} - {{^useJackson3}} - jackson_version = "2.21.5" - {{/useJackson3}} - {{^useSpringBoot4}} - {{#useJspecify}} - implementation "org.jspecify:jspecify:1.0.0" - {{/useJspecify}} - {{/useSpringBoot4}} - jackson_annotations_version = "2.21" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.11" - {{/openApiNullable}} - {{#joda}} - jodatime_version = "2.14.0" - {{/joda}} - junit_version = "5.10.2" -} - dependencies { {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" @@ -182,6 +177,11 @@ dependencies { {{^useJspecify}} implementation "com.google.code.findbugs:jsr305:3.0.2" {{/useJspecify}} + {{^useSpringBoot4}} + {{#useJspecify}} + implementation "org.jspecify:jspecify:1.0.0" + {{/useJspecify}} + {{/useSpringBoot4}} implementation "io.projectreactor:reactor-core:$reactor_version" implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version" implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version" diff --git a/modules/openapi-generator/src/main/resources/Java/oneof_interface.mustache b/modules/openapi-generator/src/main/resources/Java/oneof_interface.mustache index 0c05cf418ecc..71888430c647 100644 --- a/modules/openapi-generator/src/main/resources/Java/oneof_interface.mustache +++ b/modules/openapi-generator/src/main/resources/Java/oneof_interface.mustache @@ -1,4 +1,4 @@ -{{>additionalOneOfTypeAnnotations}}{{>generatedAnnotation}}{{>typeInfoAnnotation}}{{>deductionAnnotation}}{{>xmlAnnotation}} +{{>additionalOneOfTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{^discriminator}}{{^useDeductionForOneOfInterfaces}}{{>typeInfoAnnotation}}{{/useDeductionForOneOfInterfaces}}{{/discriminator}}{{>deductionAnnotation}}{{>xmlAnnotation}} {{#vendorExtensions.x-class-extra-annotation}} {{{.}}} {{/vendorExtensions.x-class-extra-annotation}} diff --git a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache index 23c0dbee7d35..0816a3089f5b 100644 --- a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache @@ -5,10 +5,10 @@ value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true{{#discriminator.vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{discriminator.vendorExtensions.x-jackson-resolved-default-impl}}.class{{/discriminator.vendorExtensions.x-jackson-resolved-default-impl}}) {{/disableDiscriminatorJsonIgnoreProperties}} {{#disableDiscriminatorJsonIgnoreProperties}} -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true{{#discriminator.vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{discriminator.vendorExtensions.x-jackson-resolved-default-impl}}.class{{/discriminator.vendorExtensions.x-jackson-resolved-default-impl}}) {{/disableDiscriminatorJsonIgnoreProperties}} {{#discriminator.mappedModels}} {{#-first}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/oneof_interface.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/oneof_interface.mustache index 80f3563a60d1..68cb9b85910c 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/oneof_interface.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/oneof_interface.mustache @@ -7,7 +7,7 @@ {{>typeInfoAnnotation}} {{/discriminator}}{{^discriminator}}{{#useDeductionForOneOfInterfaces}} -@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION{{#vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{vendorExtensions.x-jackson-resolved-default-impl}}.class{{/vendorExtensions.x-jackson-resolved-default-impl}}) @JsonSubTypes({ {{#interfaceModels}} @JsonSubTypes.Type(value = {{classname}}.class){{^-last}}, {{/-last}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/typeInfoAnnotation.mustache index 6d5fc85aa2d0..a8521898b1b4 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/typeInfoAnnotation.mustache @@ -6,10 +6,10 @@ value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true{{#vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{vendorExtensions.x-jackson-resolved-default-impl}}.class{{/vendorExtensions.x-jackson-resolved-default-impl}}) {{/disableDiscriminatorJsonIgnoreProperties}} {{#disableDiscriminatorJsonIgnoreProperties}} - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true{{#vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{vendorExtensions.x-jackson-resolved-default-impl}}.class{{/vendorExtensions.x-jackson-resolved-default-impl}}) {{/disableDiscriminatorJsonIgnoreProperties}} @JsonSubTypes({ {{/-first}} diff --git a/modules/openapi-generator/src/main/resources/java-camel-server/pojo.mustache b/modules/openapi-generator/src/main/resources/java-camel-server/pojo.mustache index 257e6ee3e817..67a1bf8b3dac 100644 --- a/modules/openapi-generator/src/main/resources/java-camel-server/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/java-camel-server/pojo.mustache @@ -72,6 +72,17 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} {{#vendorExtensions.x-field-extra-annotation}} {{{.}}} {{/vendorExtensions.x-field-extra-annotation}} + {{#jackson}} + {{#vendorExtensions.x-jackson-json-include-policy}} + @JsonInclude(JsonInclude.Include.{{{vendorExtensions.x-jackson-json-include-policy}}}) + {{/vendorExtensions.x-jackson-json-include-policy}} + {{#vendorExtensions.x-has-json-setter-nulls-skip}} + @JsonSetter(nulls = Nulls.SKIP) + {{/vendorExtensions.x-has-json-setter-nulls-skip}} + {{#vendorExtensions.x-has-json-setter-nulls-fail}} + @JsonSetter(nulls = Nulls.FAIL) + {{/vendorExtensions.x-has-json-setter-nulls-fail}} + {{/jackson}} {{#deprecated}} @Deprecated {{/deprecated}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/typeInfoAnnotation.mustache index c35ef3c4be2b..44b5c2842e48 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/typeInfoAnnotation.mustache @@ -2,7 +2,7 @@ value = ["{{{discriminator.propertyBaseName}}}"], // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true{{#vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{vendorExtensions.x-jackson-resolved-default-impl}}::class{{/vendorExtensions.x-jackson-resolved-default-impl}}) @JsonSubTypes( {{#discriminator.mappedModels}} JsonSubTypes.Type(value = {{modelName}}::class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"){{^-last}},{{/-last}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/oneof_interface.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/oneof_interface.mustache index 06e5c7943fe7..203a9e8d1f0d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/oneof_interface.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/oneof_interface.mustache @@ -5,7 +5,7 @@ {{>typeInfoAnnotation}} {{/discriminator}} {{^discriminator}}{{#useDeductionForOneOfInterfaces}}{{#jackson}} -@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION{{#vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{vendorExtensions.x-jackson-resolved-default-impl}}::class{{/vendorExtensions.x-jackson-resolved-default-impl}}) @JsonSubTypes( {{#interfaceModels}} JsonSubTypes.Type(value = {{classname}}::class){{^-last}},{{/-last}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/typeInfoAnnotation.mustache index b459faf88aa6..9ca94fc28233 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/typeInfoAnnotation.mustache @@ -3,7 +3,7 @@ value = ["{{{discriminator.propertyBaseName}}}"], // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true{{#vendorExtensions.x-jackson-resolved-default-impl}}, defaultImpl = {{vendorExtensions.x-jackson-resolved-default-impl}}::class{{/vendorExtensions.x-jackson-resolved-default-impl}}) @JsonSubTypes( {{#discriminator.mappedModels}} JsonSubTypes.Type(value = {{modelName}}::class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"){{^-last}},{{/-last}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index b3940c9078ba..bb0e34c3f86e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -71,6 +71,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.openapitools.codegen.CodegenConstants.*; import static org.openapitools.codegen.TestUtils.*; +import static org.openapitools.codegen.languages.AbstractJavaCodegen.USE_ONE_OF_INTERFACES; import static org.openapitools.codegen.languages.JavaClientCodegen.*; import static org.testng.Assert.*; @@ -4938,6 +4939,75 @@ public void testSwagger2TagImportRestAssured() throws IOException { .contains("@Tag("); } + // ========== x-jackson-default-impl / typeInfoDefaultImpls tests ========== + + @Test(description = "x-jackson-default-impl on deduction schema emits defaultImpl in @JsonTypeInfo (Java client)") + public void xJacksonDefaultImplOnDeductionSchemaEmitsDefaultImpl() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + additionalProperties.put(USE_ONE_OF_INTERFACES, "true"); + + final Map files = generateFromContract( + "src/test/resources/3_0/spring/jackson-default-impl.yaml", + JavaClientCodegen.RESTTEMPLATE, + additionalProperties); + + File animalFile = files.get("Animal.java"); + assertThat(animalFile).isNotNull(); + assertFileContains(animalFile.toPath(), + "@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog.class)"); + } + + @Test(description = "x-jackson-default-impl on discriminator schema emits defaultImpl in @JsonTypeInfo (Java client)") + public void xJacksonDefaultImplOnDiscriminatorSchemaEmitsDefaultImpl() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_ONE_OF_INTERFACES, "true"); + + final Map files = generateFromContract( + "src/test/resources/3_0/spring/jackson-default-impl.yaml", + JavaClientCodegen.RESTTEMPLATE, + additionalProperties); + + File fruitFile = files.get("Fruit.java"); + assertThat(fruitFile).isNotNull(); + assertFileContains(fruitFile.toPath(), + "@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = \"fruitType\", visible = true, defaultImpl = Apple.class)"); + } + + @Test(description = "typeInfoDefaultImpls config option emits defaultImpl in @JsonTypeInfo (Java client)") + public void typeInfoDefaultImplsConfigOptionEmitsDefaultImpl() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + additionalProperties.put(USE_ONE_OF_INTERFACES, "true"); + additionalProperties.put(TYPE_INFO_DEFAULT_IMPLS, Map.of("Animal", "Dog")); + + final Map files = generateFromContract( + "src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", + JavaClientCodegen.RESTTEMPLATE, + additionalProperties); + + File animalFile = files.get("Animal.java"); + assertThat(animalFile).isNotNull(); + assertFileContains(animalFile.toPath(), + "@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog.class)"); + } + + @Test(description = "no defaultImpl when neither x-jackson-default-impl nor typeInfoDefaultImpls is set (Java client)") + public void noDefaultImplWhenNeitherSourceIsSet() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + additionalProperties.put(USE_ONE_OF_INTERFACES, "true"); + + final Map files = generateFromContract( + "src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", + JavaClientCodegen.RESTTEMPLATE, + additionalProperties); + + File animalFile = files.get("Animal.java"); + assertThat(animalFile).isNotNull(); + assertFileNotContains(animalFile.toPath(), "defaultImpl"); + } + @DataProvider(name = "rxJavaOptions") public static Object[][] rxJavaOptions() { return new Object[][]{ diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index d959fdcb607a..9e9a4024020f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -8602,6 +8602,83 @@ void issue24003() throws IOException { .fileDoesNotContain("@JsonTypeName"); } + // ========== x-jackson-default-impl / typeInfoDefaultImpls tests ========== + + @Test(description = "x-jackson-default-impl on deduction schema emits defaultImpl in @JsonTypeInfo") + public void xJacksonDefaultImplOnDeductionSchemaEmitsDefaultImpl() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + + Map files = generateFromContract( + "src/test/resources/3_0/spring/jackson-default-impl.yaml", SPRING_BOOT, additionalProperties); + + JavaFileAssert.assertThat(files.get("Animal.java")) + .fileContains("@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog.class)"); + } + + @Test(description = "typeInfoDefaultImpls config option on deduction schema emits defaultImpl in @JsonTypeInfo") + public void typeInfoDefaultImplsConfigOptionOnDeductionSchemaEmitsDefaultImpl() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + additionalProperties.put(TYPE_INFO_DEFAULT_IMPLS, Map.of("Animal", "Dog")); + + Map files = generateFromContract( + "src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", SPRING_BOOT, additionalProperties); + + JavaFileAssert.assertThat(files.get("Animal.java")) + .fileContains("@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog.class)"); + } + + @Test(description = "typeInfoDefaultImpls overrides x-jackson-default-impl on deduction schema") + public void typeInfoDefaultImplsOverridesSchemaAnnotationOnDeductionSchema() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + // Override x-jackson-default-impl: Dog (set in YAML) with Cat via config option + additionalProperties.put(TYPE_INFO_DEFAULT_IMPLS, Map.of("Animal", "Cat")); + + Map files = generateFromContract( + "src/test/resources/3_0/spring/jackson-default-impl.yaml", SPRING_BOOT, additionalProperties); + + JavaFileAssert.assertThat(files.get("Animal.java")) + .fileContains("defaultImpl = Cat.class") + .fileDoesNotContain("defaultImpl = Dog.class"); + } + + @Test(description = "x-jackson-default-impl on discriminator schema emits defaultImpl in @JsonTypeInfo") + public void xJacksonDefaultImplOnDiscriminatorSchemaEmitsDefaultImpl() throws IOException { + Map files = generateFromContract( + "src/test/resources/3_0/spring/jackson-default-impl.yaml", SPRING_BOOT, new HashMap<>()); + + JavaFileAssert.assertThat(files.get("Fruit.java")) + .fileContains("defaultImpl = Apple.class"); + } + + @Test(description = "no defaultImpl when neither x-jackson-default-impl nor typeInfoDefaultImpls is set") + public void noDefaultImplWhenNeitherSourceIsSet() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + + Map files = generateFromContract( + "src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", SPRING_BOOT, additionalProperties); + + JavaFileAssert.assertThat(files.get("Animal.java")) + .fileDoesNotContain("defaultImpl"); + } + + @Test(description = "typeInfoDefaultImpls applies model name suffix to resolved default impl") + public void typeInfoDefaultImplsAppliesModelNameSuffix() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + additionalProperties.put(TYPE_INFO_DEFAULT_IMPLS, Map.of("Animal", "Dog")); + additionalProperties.put(MODEL_NAME_SUFFIX, "Dto"); + + Map files = generateFromContract( + "src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", SPRING_BOOT, additionalProperties); + + JavaFileAssert.assertThat(files.get("AnimalDto.java")) + .fileContains("defaultImpl = DogDto.class"); + } + /** * Issue #24401: the {@code @JsonInclude(NON_ABSENT)} annotation must no longer be emitted for * {@code JsonNullable} fields, as the JsonNullable module already governs their inclusion. diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java index d2972a65bbe9..921cd035aeb4 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java @@ -35,6 +35,7 @@ import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -1422,4 +1423,86 @@ private ModelNameTest(String expectedName, String expectedClassName) { this.expectedClassName = expectedClassName; } } + + // ===== typeInfoDefaultImpls / x-jackson-default-impl tests for kotlin-client ===== + + @Test + public void testXJacksonDefaultImplOnDiscriminatorSchemaEmitsDefaultImpl() throws IOException { + // x-jackson-default-impl on a discriminator-based oneOf schema should produce + // defaultImpl = Apple::class in the @JsonTypeInfo annotation on the Fruit sealed class. + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("kotlin") + .setInputSpec("src/test/resources/3_0/spring/jackson-default-impl.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")) + .addAdditionalProperty(CodegenConstants.SERIALIZATION_LIBRARY, "jackson"); + + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(configurator.toClientOptInput()).generate(); + + Path fruitModel = Paths.get(output.getAbsolutePath(), + "src/main/kotlin/org/openapitools/client/models/Fruit.kt"); + TestUtils.assertFileContains(fruitModel, "defaultImpl = Apple::class"); + } + + @Test + public void testTypeInfoDefaultImplsConfigOptionEmitsDefaultImpl() throws IOException { + // typeInfoDefaultImpls config option should produce defaultImpl = Banana::class + // on the Fruit sealed class, overriding the x-jackson-default-impl: Apple in the spec. + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("kotlin") + .setInputSpec("src/test/resources/3_0/spring/jackson-default-impl.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")) + .addAdditionalProperty(CodegenConstants.SERIALIZATION_LIBRARY, "jackson") + .addAdditionalProperty(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS, Map.of("Fruit", "Banana")); + + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(configurator.toClientOptInput()).generate(); + + Path fruitModel = Paths.get(output.getAbsolutePath(), + "src/main/kotlin/org/openapitools/client/models/Fruit.kt"); + TestUtils.assertFileContains(fruitModel, "defaultImpl = Banana::class"); + TestUtils.assertFileNotContains(fruitModel, "defaultImpl = Apple::class"); + } + + @Test + public void testNoDefaultImplWhenNeitherSourceIsSet() throws IOException { + // When neither typeInfoDefaultImpls nor x-jackson-default-impl is set, + // the @JsonTypeInfo annotation must not include defaultImpl. + // Uses a spec with discriminator-based oneOf so @JsonTypeInfo is actually generated, + // making the negative assertion on defaultImpl meaningful. + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("kotlin") + .setInputSpec("src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")) + .addAdditionalProperty(CodegenConstants.SERIALIZATION_LIBRARY, "jackson"); + + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(configurator.toClientOptInput()).generate(); + + // The oneOf interface code path must be exercised (at least one @JsonTypeInfo emitted)... + File modelsDir = Paths.get(output.getAbsolutePath(), + "src/main/kotlin/org/openapitools/client/models").toFile(); + Assert.assertTrue(modelsDir.exists(), "Expected generated models directory"); + boolean sawJsonTypeInfo = false; + for (File modelFile : modelsDir.listFiles()) { + String content = Files.readString(modelFile.toPath()); + if (content.contains("@JsonTypeInfo")) { + sawJsonTypeInfo = true; + } + // ...but no model may include defaultImpl since neither source is set. + Assert.assertFalse(content.contains("defaultImpl"), + "Expected no 'defaultImpl' in " + modelFile.getName() + " but found it"); + } + Assert.assertTrue(sawJsonTypeInfo, + "Expected at least one generated model with @JsonTypeInfo to exercise the code path"); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index edad12367b27..b4ae1810d537 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -7511,6 +7511,95 @@ public void schemaMappingWithNullableAllOfRendersNullableKotlinProperty() throws assertThat(content).contains("com.example.ExternalModel?"); } + // ========== x-jackson-default-impl / typeInfoDefaultImpls tests ========== + + @Test(description = "x-jackson-default-impl on deduction schema emits defaultImpl in @JsonTypeInfo") + public void xJacksonDefaultImplOnDeductionSchemaEmitsDefaultImpl() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + + Map files = generateFromContract( + "src/test/resources/3_0/spring/jackson-default-impl.yaml", additionalProperties); + + File animalFile = files.get("Animal.kt"); + assertThat(animalFile).isNotNull(); + assertFileContains(animalFile.toPath(), + "@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog::class)"); + } + + @Test(description = "typeInfoDefaultImpls config option on deduction schema emits defaultImpl in @JsonTypeInfo") + public void typeInfoDefaultImplsConfigOptionOnDeductionSchemaEmitsDefaultImpl() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + additionalProperties.put(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS, Map.of("Animal", "Dog")); + Map files = generateFromContract( + "src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", additionalProperties); + + File animalFile = files.get("Animal.kt"); + assertThat(animalFile).isNotNull(); + assertFileContains(animalFile.toPath(), + "@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog::class)"); + } + + @Test(description = "typeInfoDefaultImpls overrides x-jackson-default-impl on deduction schema") + public void typeInfoDefaultImplsOverridesSchemaAnnotationOnDeductionSchema() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + // Override x-jackson-default-impl: Dog (set in YAML) with Cat via config option + additionalProperties.put(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS, Map.of("Animal", "Cat")); + + Map files = generateFromContract( + "src/test/resources/3_0/spring/jackson-default-impl.yaml", additionalProperties); + + File animalFile = files.get("Animal.kt"); + assertThat(animalFile).isNotNull(); + String content = Files.readString(animalFile.toPath()); + assertThat(content).contains("defaultImpl = Cat::class"); + assertThat(content).doesNotContain("defaultImpl = Dog::class"); + } + + @Test(description = "x-jackson-default-impl on discriminator schema emits defaultImpl in @JsonTypeInfo") + public void xJacksonDefaultImplOnDiscriminatorSchemaEmitsDefaultImpl() throws IOException { + Map files = generateFromContract( + "src/test/resources/3_0/spring/jackson-default-impl.yaml", new HashMap<>()); + + File fruitFile = files.get("Fruit.kt"); + assertThat(fruitFile).isNotNull(); + assertFileContains(fruitFile.toPath(), + "@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, " + + "property = \"fruitType\", visible = true, defaultImpl = Apple::class)"); + } + + @Test(description = "no defaultImpl when neither x-jackson-default-impl nor typeInfoDefaultImpls is set") + public void noDefaultImplWhenNeitherSourceIsSet() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + + // Use the YAML without x-jackson-default-impl; don't pass typeInfoDefaultImpls + Map files = generateFromContract( + "src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", additionalProperties); + + File animalFile = files.get("Animal.kt"); + assertThat(animalFile).isNotNull(); + assertFileNotContains(animalFile.toPath(), "defaultImpl"); + } + + @Test(description = "typeInfoDefaultImpls applies model name suffix to resolved default impl") + public void typeInfoDefaultImplsAppliesModelNameSuffix() throws IOException { + Map additionalProperties = new HashMap<>(); + additionalProperties.put(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "true"); + additionalProperties.put(CodegenConstants.TYPE_INFO_DEFAULT_IMPLS, Map.of("Animal", "Dog")); + additionalProperties.put(CodegenConstants.MODEL_NAME_SUFFIX, "Dto"); + + Map files = generateFromContract( + "src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", additionalProperties); + + File animalFile = files.get("AnimalDto.kt"); + assertThat(animalFile).isNotNull(); + assertFileContains(animalFile.toPath(), "defaultImpl = DogDto::class"); + } + + @Test(description = "nameMappings: @param:JsonProperty must use the original JSON field name for deserialization") public void paramJsonPropertyAnnotationWithNameMappings() throws IOException { // When a property is renamed via nameMappings, @param:JsonProperty must carry the diff --git a/modules/openapi-generator/src/test/resources/3_0/jackson-default-impl-oneof.yaml b/modules/openapi-generator/src/test/resources/3_0/jackson-default-impl-oneof.yaml new file mode 100644 index 000000000000..5dda0cb6ee51 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/jackson-default-impl-oneof.yaml @@ -0,0 +1,152 @@ +openapi: 3.0.1 +info: + title: Jackson defaultImpl oneOf sample + description: > + Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf + interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) + and the typeInfoDefaultImpls generator option (config-based). + version: 0.0.1 +servers: + - url: "http://localhost:8080" +paths: + /animals: + post: + tags: + - default + operationId: createAnimal + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Animal' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Animal' + /fruits: + post: + tags: + - default + operationId: createFruit + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Fruit' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Fruit' + /beverages: + post: + tags: + - default + operationId: createBeverage + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Beverage' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Beverage' +components: + schemas: + # Deduction-based oneOf (no discriminator): default impl set via the spec extension. + Animal: + x-jackson-default-impl: Dog + oneOf: + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Cat' + Dog: + type: object + properties: + bark: + type: boolean + Cat: + type: object + properties: + declawed: + type: boolean + # Discriminator-based oneOf: default impl resolved via the typeInfoDefaultImpls config option. + Fruit: + type: object + properties: + fruitType: + type: string + required: + - fruitType + oneOf: + - $ref: '#/components/schemas/Apple' + - $ref: '#/components/schemas/Banana' + discriminator: + propertyName: fruitType + mapping: + APPLE: '#/components/schemas/Apple' + BANANA: '#/components/schemas/Banana' + Apple: + type: object + required: + - fruitType + properties: + fruitType: + type: string + seeds: + type: integer + Banana: + type: object + required: + - fruitType + properties: + fruitType: + type: string + length: + type: integer + # Discriminator-based oneOf: default impl set via the spec extension. + Beverage: + x-jackson-default-impl: Water + type: object + properties: + beverageType: + type: string + required: + - beverageType + oneOf: + - $ref: '#/components/schemas/Water' + - $ref: '#/components/schemas/Soda' + discriminator: + propertyName: beverageType + mapping: + WATER: '#/components/schemas/Water' + SODA: '#/components/schemas/Soda' + Water: + type: object + required: + - beverageType + properties: + beverageType: + type: string + sparkling: + type: boolean + Soda: + type: object + required: + - beverageType + properties: + beverageType: + type: string + sugarGrams: + type: integer diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/jackson-default-impl.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/jackson-default-impl.yaml new file mode 100644 index 000000000000..4ec082a6323e --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/spring/jackson-default-impl.yaml @@ -0,0 +1,66 @@ +openapi: 3.0.1 +info: + title: Jackson defaultImpl test + version: 0.0.1 +paths: + /animals: + post: + operationId: createAnimal + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Animal' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Fruit' +components: + schemas: + # Deduction-based oneOf: no discriminator, x-jackson-default-impl set + Animal: + x-jackson-default-impl: Dog + oneOf: + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Cat' + Dog: + type: object + properties: + bark: + type: boolean + Cat: + type: object + properties: + declawed: + type: boolean + # Discriminator-based oneOf: has discriminator, x-jackson-default-impl set + Fruit: + x-jackson-default-impl: Apple + type: object + properties: + fruitType: + type: string + required: + - fruitType + oneOf: + - $ref: '#/components/schemas/Apple' + - $ref: '#/components/schemas/Banana' + discriminator: + propertyName: fruitType + mapping: + APPLE: '#/components/schemas/Apple' + BANANA: '#/components/schemas/Banana' + Apple: + type: object + properties: + seeds: + type: integer + Banana: + type: object + properties: + length: + type: integer diff --git a/samples/client/echo_api/java/apache-httpclient/build.gradle b/samples/client/echo_api/java/apache-httpclient/build.gradle index bf7abfef0000..8cb8cb9005dc 100644 --- a/samples/client/echo_api/java/apache-httpclient/build.gradle +++ b/samples/client/echo_api/java/apache-httpclient/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.6" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + httpclient_version = "5.6.3" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -118,18 +130,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.6" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - httpclient_version = "5.6.3" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/echo_api/java/feign-gson/build.gradle b/samples/client/echo_api/java/feign-gson/build.gradle index 7cbe23895efd..d78e5fad1204 100644 --- a/samples/client/echo_api/java/feign-gson/build.gradle +++ b/samples/client/echo_api/java/feign-gson/build.gradle @@ -19,6 +19,16 @@ repositories { } +ext { + swagger_annotations_version = "1.6.11" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + feign_version = "13.5" + feign_form_version = "3.8.0" + junit_version = "5.7.0" + scribejava_version = "8.0.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -102,16 +112,6 @@ test { useJUnitPlatform() } -ext { - swagger_annotations_version = "1.6.11" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - feign_version = "13.5" - feign_form_version = "3.8.0" - junit_version = "5.7.0" - scribejava_version = "8.0.0" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle index 930bcc11cef9..b96ec1dcfd90 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/echo_api/java/okhttp-gson/build.gradle b/samples/client/echo_api/java/okhttp-gson/build.gradle index 61569dcc78f9..2c1e79616363 100644 --- a/samples/client/echo_api/java/okhttp-gson/build.gradle +++ b/samples/client/echo_api/java/okhttp-gson/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/echo_api/java/restclient/build.gradle b/samples/client/echo_api/java/restclient/build.gradle index d3fe1aff0fae..44ca6b2db919 100644 --- a/samples/client/echo_api/java/restclient/build.gradle +++ b/samples/client/echo_api/java/restclient/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/echo_api/java/resteasy/build.gradle b/samples/client/echo_api/java/resteasy/build.gradle index b3cc7337b382..00d2c0272ab0 100644 --- a/samples/client/echo_api/java/resteasy/build.gradle +++ b/samples/client/echo_api/java/resteasy/build.gradle @@ -19,6 +19,18 @@ repositories { } +ext { + swagger_annotations_version = "1.6.3" + jackson_version = "2.21.5" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + threetenbp_version = "2.9.10" + resteasy_version = "4.5.11.Final" + assertj_version = "3.23.1" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,18 +110,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.3" - jackson_version = "2.21.5" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - threetenbp_version = "2.9.10" - resteasy_version = "4.5.11.Final" - assertj_version = "3.23.1" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/echo_api/java/resttemplate/build.gradle b/samples/client/echo_api/java/resttemplate/build.gradle index 152914ce95a8..50f6a96b6b02 100644 --- a/samples/client/echo_api/java/resttemplate/build.gradle +++ b/samples/client/echo_api/java/resttemplate/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "5.3.33" + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "5.3.33" - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/others/java/jersey2-oneOf-Mixed/build.gradle b/samples/client/others/java/jersey2-oneOf-Mixed/build.gradle index e592db8b045e..98024c2df252 100644 --- a/samples/client/others/java/jersey2-oneOf-Mixed/build.gradle +++ b/samples/client/others/java/jersey2-oneOf-Mixed/build.gradle @@ -20,6 +20,16 @@ repositories { mavenCentral() } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,16 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" diff --git a/samples/client/others/java/jersey2-oneOf-duplicates/build.gradle b/samples/client/others/java/jersey2-oneOf-duplicates/build.gradle index e592db8b045e..98024c2df252 100644 --- a/samples/client/others/java/jersey2-oneOf-duplicates/build.gradle +++ b/samples/client/others/java/jersey2-oneOf-duplicates/build.gradle @@ -20,6 +20,16 @@ repositories { mavenCentral() } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,16 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" diff --git a/samples/client/others/java/okhttp-gson-oneOf-array/build.gradle b/samples/client/others/java/okhttp-gson-oneOf-array/build.gradle index 3894157aef97..09fc129d4a67 100644 --- a/samples/client/others/java/okhttp-gson-oneOf-array/build.gradle +++ b/samples/client/others/java/okhttp-gson-oneOf-array/build.gradle @@ -24,6 +24,11 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,11 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/others/java/okhttp-gson-oneOf/build.gradle b/samples/client/others/java/okhttp-gson-oneOf/build.gradle index 092df227eae7..1d481b4ceb38 100644 --- a/samples/client/others/java/okhttp-gson-oneOf/build.gradle +++ b/samples/client/others/java/okhttp-gson-oneOf/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/others/java/okhttp-gson-streaming/build.gradle b/samples/client/others/java/okhttp-gson-streaming/build.gradle index 1252de88dd6e..160f5cfb12e1 100644 --- a/samples/client/others/java/okhttp-gson-streaming/build.gradle +++ b/samples/client/others/java/okhttp-gson-streaming/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/others/java/restclient-enum-in-multipart/build.gradle b/samples/client/others/java/restclient-enum-in-multipart/build.gradle index bf9100bfe4c5..564ac37e82c5 100644 --- a/samples/client/others/java/restclient-enum-in-multipart/build.gradle +++ b/samples/client/others/java/restclient-enum-in-multipart/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/others/java/restclient-jackson-default-impl/.github/workflows/maven.yml b/samples/client/others/java/restclient-jackson-default-impl/.github/workflows/maven.yml new file mode 100644 index 000000000000..0e24b2258b60 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build Jackson defaultImpl oneOf sample + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/others/java/restclient-jackson-default-impl/.gitignore b/samples/client/others/java/restclient-jackson-default-impl/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator-ignore b/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator/FILES b/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator/FILES new file mode 100644 index 000000000000..ba2c8c8392b4 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator/FILES @@ -0,0 +1,49 @@ +.github/workflows/maven.yml +.gitignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Animal.md +docs/Apple.md +docs/Banana.md +docs/Beverage.md +docs/Cat.md +docs/DefaultApi.md +docs/Dog.md +docs/Fruit.md +docs/Soda.md +docs/Water.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ExceptionProvider.java +src/main/java/org/openapitools/client/JavaTimeFormatter.java +src/main/java/org/openapitools/client/RFC3339DateFormat.java +src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/Apple.java +src/main/java/org/openapitools/client/model/Banana.java +src/main/java/org/openapitools/client/model/Beverage.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/Fruit.java +src/main/java/org/openapitools/client/model/Soda.java +src/main/java/org/openapitools/client/model/Water.java diff --git a/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator/VERSION b/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator/VERSION new file mode 100644 index 000000000000..8fc8df61083a --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.25.0-SNAPSHOT diff --git a/samples/client/others/java/restclient-jackson-default-impl/.travis.yml b/samples/client/others/java/restclient-jackson-default-impl/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/.travis.yml @@ -0,0 +1,22 @@ +# +# Generated by OpenAPI Generator: https://openapi-generator.tech +# +# Ref: https://docs.travis-ci.com/user/languages/java/ +# +language: java +jdk: + - openjdk12 + - openjdk11 + - openjdk10 + - openjdk9 + - openjdk8 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + #- mvn test + # test using gradle + - gradle test + # test using sbt + # - sbt test diff --git a/samples/client/others/java/restclient-jackson-default-impl/README.md b/samples/client/others/java/restclient-jackson-default-impl/README.md new file mode 100644 index 000000000000..b12c1f41b76a --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/README.md @@ -0,0 +1,150 @@ +# restclient-jackson-default-impl + +Jackson defaultImpl oneOf sample + +- API version: 0.0.1 + +- Generator version: 7.25.0-SNAPSHOT + +Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 17+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + restclient-jackson-default-impl + 0.0.1 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'restclient-jackson-default-impl' jar has been published to maven central. + mavenLocal() // Needed if the 'restclient-jackson-default-impl' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:restclient-jackson-default-impl:0.0.1" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/restclient-jackson-default-impl-0.0.1.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.DefaultApi; + +public class DefaultApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = new ApiClient(); + defaultClient.setBasePath("http://localhost:8080"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + Animal animal = new Animal(); // Animal | + try { + Animal result = apiInstance.createAnimal(animal); + System.out.println(result); + } catch (HttpStatusCodeException e) { + System.err.println("Exception when calling DefaultApi#createAnimal"); + System.err.println("Status code: " + e.getStatusCode().value()); + System.err.println("Reason: " + e.getResponseBodyAsString()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:8080* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**createAnimal**](docs/DefaultApi.md#createAnimal) | **POST** /animals | +*DefaultApi* | [**createBeverage**](docs/DefaultApi.md#createBeverage) | **POST** /beverages | +*DefaultApi* | [**createFruit**](docs/DefaultApi.md#createFruit) | **POST** /fruits | + + +## Documentation for Models + + - [Animal](docs/Animal.md) + - [Apple](docs/Apple.md) + - [Banana](docs/Banana.md) + - [Beverage](docs/Beverage.md) + - [Cat](docs/Cat.md) + - [Dog](docs/Dog.md) + - [Fruit](docs/Fruit.md) + - [Soda](docs/Soda.md) + - [Water](docs/Water.md) + + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/api/openapi.yaml b/samples/client/others/java/restclient-jackson-default-impl/api/openapi.yaml new file mode 100644 index 000000000000..2a5e5f932fa3 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/api/openapi.yaml @@ -0,0 +1,166 @@ +openapi: 3.0.1 +info: + description: | + Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + title: Jackson defaultImpl oneOf sample + version: 0.0.1 +servers: +- url: http://localhost:8080 +paths: + /animals: + post: + operationId: createAnimal + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Animal" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Animal" + description: OK + tags: + - default + x-content-type: application/json + x-accepts: + - application/json + /fruits: + post: + operationId: createFruit + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Fruit" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Fruit" + description: OK + tags: + - default + x-content-type: application/json + x-accepts: + - application/json + /beverages: + post: + operationId: createBeverage + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Beverage" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Beverage" + description: OK + tags: + - default + x-content-type: application/json + x-accepts: + - application/json +components: + schemas: + Animal: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + x-jackson-default-impl: Dog + x-one-of-name: Animal + Dog: + example: + bark: true + properties: + bark: + type: boolean + type: object + Cat: + properties: + declawed: + type: boolean + type: object + Fruit: + discriminator: + mapping: + APPLE: "#/components/schemas/Apple" + BANANA: "#/components/schemas/Banana" + propertyName: fruitType + example: + fruitType: fruitType + oneOf: + - $ref: "#/components/schemas/Apple" + - $ref: "#/components/schemas/Banana" + properties: + fruitType: + type: string + required: + - fruitType + type: object + x-one-of-name: Fruit + Apple: + properties: + fruitType: + type: string + seeds: + type: integer + required: + - fruitType + type: object + Banana: + properties: + fruitType: + type: string + length: + type: integer + required: + - fruitType + type: object + Beverage: + discriminator: + mapping: + WATER: "#/components/schemas/Water" + SODA: "#/components/schemas/Soda" + propertyName: beverageType + example: + beverageType: beverageType + oneOf: + - $ref: "#/components/schemas/Water" + - $ref: "#/components/schemas/Soda" + properties: + beverageType: + type: string + required: + - beverageType + type: object + x-jackson-default-impl: Water + x-one-of-name: Beverage + Water: + properties: + beverageType: + type: string + sparkling: + type: boolean + required: + - beverageType + type: object + Soda: + properties: + beverageType: + type: string + sugarGrams: + type: integer + required: + - beverageType + type: object + diff --git a/samples/client/others/java/restclient-jackson-default-impl/build.gradle b/samples/client/others/java/restclient-jackson-default-impl/build.gradle new file mode 100644 index 000000000000..1d2a48e66048 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/build.gradle @@ -0,0 +1,136 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'org.openapitools' +version = '0.0.1' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + } +} + +repositories { + mavenCentral() +} + + +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 23 + buildToolsVersion '23.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 22 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + + // 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 "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + 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.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + archiveClassifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + publishing { + publications { + maven(MavenPublication) { + artifactId = 'restclient-jackson-default-impl' + from components.java + } + } + } + + task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +dependencies { + implementation "org.springframework:spring-web:$spring_web_version" + implementation "org.springframework:spring-context:$spring_web_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/build.sbt b/samples/client/others/java/restclient-jackson-default-impl/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Animal.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Animal.md new file mode 100644 index 000000000000..324c70fa7d96 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Animal.md @@ -0,0 +1,10 @@ + + +# Interface Animal + +## Implementing Classes + +* Cat +* Dog + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Apple.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Apple.md new file mode 100644 index 000000000000..c618f3ba45ac --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Apple.md @@ -0,0 +1,18 @@ + + +# Apple + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**fruitType** | **String** | | | +|**seeds** | **Integer** | | [optional] | + + +## Implemented Interfaces + +* Fruit + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Banana.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Banana.md new file mode 100644 index 000000000000..8e02b3876e0e --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Banana.md @@ -0,0 +1,18 @@ + + +# Banana + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**fruitType** | **String** | | | +|**length** | **Integer** | | [optional] | + + +## Implemented Interfaces + +* Fruit + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Beverage.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Beverage.md new file mode 100644 index 000000000000..020391d14af1 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Beverage.md @@ -0,0 +1,10 @@ + + +# Interface Beverage + +## Implementing Classes + +* Soda +* Water + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Cat.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Cat.md new file mode 100644 index 000000000000..b893148b66b5 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Cat.md @@ -0,0 +1,17 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + +## Implemented Interfaces + +* Animal + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/DefaultApi.md b/samples/client/others/java/restclient-jackson-default-impl/docs/DefaultApi.md new file mode 100644 index 000000000000..eb7f6c30b8ad --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/DefaultApi.md @@ -0,0 +1,203 @@ +# DefaultApi + +All URIs are relative to *http://localhost:8080* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createAnimal**](DefaultApi.md#createAnimal) | **POST** /animals | | +| [**createBeverage**](DefaultApi.md#createBeverage) | **POST** /beverages | | +| [**createFruit**](DefaultApi.md#createFruit) | **POST** /fruits | | + + + +## createAnimal + +> Animal createAnimal(animal) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:8080"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + Animal animal = new Animal(); // Animal | + try { + Animal result = apiInstance.createAnimal(animal); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#createAnimal"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **animal** | [**Animal**](Animal.md)| | | + +### Return type + +[**Animal**](Animal.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +## createBeverage + +> Beverage createBeverage(beverage) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:8080"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + Beverage beverage = new Beverage(); // Beverage | + try { + Beverage result = apiInstance.createBeverage(beverage); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#createBeverage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **beverage** | [**Beverage**](Beverage.md)| | | + +### Return type + +[**Beverage**](Beverage.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +## createFruit + +> Fruit createFruit(fruit) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:8080"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + Fruit fruit = new Fruit(); // Fruit | + try { + Fruit result = apiInstance.createFruit(fruit); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#createFruit"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fruit** | [**Fruit**](Fruit.md)| | | + +### Return type + +[**Fruit**](Fruit.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Dog.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Dog.md new file mode 100644 index 000000000000..25628713ba08 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Dog.md @@ -0,0 +1,17 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bark** | **Boolean** | | [optional] | + + +## Implemented Interfaces + +* Animal + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Fruit.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Fruit.md new file mode 100644 index 000000000000..95426f21aa1d --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Fruit.md @@ -0,0 +1,10 @@ + + +# Interface Fruit + +## Implementing Classes + +* Apple +* Banana + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Soda.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Soda.md new file mode 100644 index 000000000000..dc5c68993ea6 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Soda.md @@ -0,0 +1,18 @@ + + +# Soda + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**beverageType** | **String** | | | +|**sugarGrams** | **Integer** | | [optional] | + + +## Implemented Interfaces + +* Beverage + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/docs/Water.md b/samples/client/others/java/restclient-jackson-default-impl/docs/Water.md new file mode 100644 index 000000000000..279bf43538ff --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/docs/Water.md @@ -0,0 +1,18 @@ + + +# Water + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**beverageType** | **String** | | | +|**sparkling** | **Boolean** | | [optional] | + + +## Implemented Interfaces + +* Beverage + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/git_push.sh b/samples/client/others/java/restclient-jackson-default-impl/git_push.sh new file mode 100644 index 000000000000..a35991cd51a1 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/git_push.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ -z "${git_host}" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \${git_host} to ${git_host}" +fi + +if [ -z "${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 [ -z "${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 [ -z "${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 +if [ -z "$(git remote)" ]; then # git remote not defined + if [ -z "${GIT_TOKEN:-}" ]; then + echo "[INFO] \${GIT_TOKEN} (environment variable) is not set. Using the git credential in your environment." + git remote add origin "https://${git_host}/${git_user_id}/${git_repo_id}.git" + else + git remote add origin "https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git" + fi +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/others/java/restclient-jackson-default-impl/gradle.properties b/samples/client/others/java/restclient-jackson-default-impl/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/others/java/restclient-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar b/samples/client/others/java/restclient-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/client/others/java/restclient-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/others/java/restclient-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties b/samples/client/others/java/restclient-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..4f5eb9dcc0ef --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/others/java/restclient-jackson-default-impl/gradlew b/samples/client/others/java/restclient-jackson-default-impl/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/others/java/restclient-jackson-default-impl/gradlew.bat b/samples/client/others/java/restclient-jackson-default-impl/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/others/java/restclient-jackson-default-impl/pom.xml b/samples/client/others/java/restclient-jackson-default-impl/pom.xml new file mode 100644 index 000000000000..79d27be5cb61 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/pom.xml @@ -0,0 +1,275 @@ + + 4.0.0 + org.openapitools + restclient-jackson-default-impl + jar + restclient-jackson-default-impl + 0.0.1 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + http://unlicense.org + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.6.2 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.5.4 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + false + true + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.5.0 + + + + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.6.1 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.15.0 + + 17 + 17 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.12.0 + + none + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.4.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.8 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + + org.springframework + spring-web + ${spring-web-version} + + + org.springframework + spring-context + ${spring-web-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-annotations-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + + UTF-8 + + 6.2.16 + 2.21.5 + 2.1.1 + + 2.21 + 0.2.11 + 3.1.1 + 5.10.2 + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/settings.gradle b/samples/client/others/java/restclient-jackson-default-impl/settings.gradle new file mode 100644 index 000000000000..83a062a9a5d6 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "restclient-jackson-default-impl" \ No newline at end of file diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/AndroidManifest.xml b/samples/client/others/java/restclient-jackson-default-impl/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..bcc76dde8b46 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,864 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class 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.DeserializationFeature; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; + +import java.util.function.Consumer; +import org.openapitools.jackson.nullable.JsonNullableModule; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.InvalidMediaTypeException; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.util.CollectionUtils; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.util.StringUtils; +import org.springframework.web.client.RestClientException; +import org.springframework.web.util.UriComponentsBuilder; +import org.springframework.web.client.RestClient; +import org.springframework.web.client.RestClient.ResponseSpec; +import java.util.Optional; + +import java.text.DateFormat; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TimeZone; +import java.util.function.Supplier; + +import jakarta.annotation.Nullable; + +import java.time.OffsetDateTime; + +import org.openapitools.client.auth.Authentication; +import org.openapitools.client.auth.HttpBasicAuth; +import org.openapitools.client.auth.HttpBearerAuth; +import org.openapitools.client.auth.ApiKeyAuth; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class ApiClient extends JavaTimeFormatter { + public enum CollectionFormat { + CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); + + protected final String separator; + CollectionFormat(String separator) { + this.separator = separator; + } + + protected String collectionToString(Collection collection) { + return StringUtils.collectionToDelimitedString(collection, separator); + } + } + + protected final HttpHeaders defaultHeaders = new HttpHeaders(); + protected final MultiValueMap defaultCookies = new LinkedMultiValueMap<>(); + + protected String basePath = "http://localhost:8080"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://localhost:8080", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + + protected final RestClient restClient; + protected final DateFormat dateFormat; + protected final ObjectMapper mapper; + protected Map authentications; + + /** + * The {@link ExceptionProvider} used to create exceptions thrown by this client. + * Defaults to {@link ExceptionProvider#DEFAULT}. Can be replaced to customize the exceptions + * thrown by this client by calling {@link #setExceptionProvider(ExceptionProvider)}. + */ + protected ExceptionProvider exceptionProvider = ExceptionProvider.DEFAULT; + + + public ApiClient() { + this(null); + } + + public ApiClient(RestClient restClient) { + this(restClient, createDefaultDateFormat()); + } + + public ApiClient(ObjectMapper mapper, DateFormat format) { + this(null, mapper, format); + } + + public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) { + this.mapper = mapper.copy(); + this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.mapper)); + this.dateFormat = format; + this.init(); + } + + protected ApiClient(RestClient restClient, DateFormat format) { + this(restClient, createDefaultMapper(format), format); + } + + public static DateFormat createDefaultDateFormat() { + DateFormat dateFormat = new RFC3339DateFormat(); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return dateFormat; + } + + public static ObjectMapper createDefaultMapper(@Nullable DateFormat dateFormat) { + if (null == dateFormat) { + dateFormat = createDefaultDateFormat(); + } + ObjectMapper mapper = new ObjectMapper(); + mapper.setDateFormat(dateFormat); + mapper.registerModule(new JavaTimeModule()); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + return mapper; + } + + protected void init() { + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap<>(); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Build the RestClientBuilder used to make RestClient. + * @param mapper ObjectMapper used for serialize/deserialize + * @return RestClient + */ + public static RestClient.Builder buildRestClientBuilder(ObjectMapper mapper) { + + Consumer>> messageConverters = converters -> { + converters.add(0, new MappingJackson2HttpMessageConverter(mapper)); + }; + + return RestClient.builder().messageConverters(messageConverters); + } + + /** + * Build the RestClientBuilder used to make RestClient. + * @return RestClient + */ + public static RestClient.Builder buildRestClientBuilder() { + return buildRestClientBuilder(createDefaultMapper(null)); + } + + /** + * Build the RestClient used to make HTTP requests. + * @param mapper ObjectMapper used for serialize/deserialize + * @return RestClient + */ + public static RestClient buildRestClient(ObjectMapper mapper) { + return buildRestClientBuilder(mapper).build(); + } + + /** + * Build the RestClient used to make HTTP requests. + * @return RestClient + */ + public static RestClient buildRestClient() { + return buildRestClientBuilder(createDefaultMapper(null)).build(); + } + + /** + * Get the current base path + * @return String the base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set the base path, which should include the host + * @param basePath the base path + * @return ApiClient this client + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * @return Map the currently configured authentication types + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get the current {@link ExceptionProvider}. + * @return the exception provider + */ + public ExceptionProvider getExceptionProvider() { + return exceptionProvider; + } + + /** + * Set a custom {@link ExceptionProvider} to control which exception types are thrown + * by this client. + * @param exceptionProvider the exception provider + * @return this client instance + */ + public ApiClient setExceptionProvider(ExceptionProvider exceptionProvider) { + this.exceptionProvider = exceptionProvider; + return this; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return; + } + } + throw exceptionProvider.bearerAuthException(); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier the token supplier function + */ + public void setBearerToken(Supplier tokenSupplier) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); + return; + } + } + throw exceptionProvider.bearerAuthException(); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * @param username the username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw exceptionProvider.httpBasicAuthException(); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * @param password the password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw exceptionProvider.httpBasicAuthException(); + } + + /** + * Helper method to set API key value for the first API key authentication. + * @param apiKey the API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw exceptionProvider.apiKeyAuthException(); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix the API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw exceptionProvider.apiKeyAuthException(); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent the user agent string + * @return ApiClient this client + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param name The header's name + * @param value The header's value + * @return ApiClient this client + */ + public ApiClient addDefaultHeader(String name, String value) { + defaultHeaders.set(name, value); + return this; + } + + /** + * Add a default cookie. + * + * @param name The cookie's name + * @param value The cookie's value + * @return ApiClient this client + */ + public ApiClient addDefaultCookie(String name, String value) { + if (defaultCookies.containsKey(name)) { + defaultCookies.remove(name); + } + defaultCookies.add(name, value); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * @return DateFormat format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Parse the given string into Date object. + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (ParseException e) { + throw exceptionProvider.dateTimeException(e); + } + } + + /** + * Format the given Date object into string. + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Get the ObjectMapper used to make HTTP requests. + * @return ObjectMapper mapper + */ + public ObjectMapper getObjectMapper() { + return mapper; + } + + /** + * Get the RestClient used to make HTTP requests. + * @return RestClient restClient + */ + public RestClient getRestClient() { + return restClient; + } + + /** + * Format the given parameter object into string. + * @param param the object to convert + * @return String the parameter represented as a String + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate( (Date) param); + } else if (param instanceof OffsetDateTime) { + return formatOffsetDateTime((OffsetDateTime) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection) param) { + if(b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Converts a parameter to a {@link MultiValueMap} containing Json-serialized values for use in REST requests + * @param collectionFormat The format to convert to + * @param name The name of the parameter + * @param value The parameter's value + * @return a Map containing the Json-serialized String value(s) of the input parameter + */ + public MultiValueMap parameterToMultiValueMapJson(CollectionFormat collectionFormat, String name, Object value) { + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + try { + return parameterToMultiValueMap(collectionFormat, name, mapper.writeValueAsString(value)); + } catch (JsonProcessingException e) { + throw exceptionProvider.jacksonException(e); + } + } + + List values = new ArrayList<>(); + for(Object o : valueCollection) { + try { + values.add(mapper.writeValueAsString(o)); + } catch (JsonProcessingException e) { + throw exceptionProvider.jacksonException(e); + } + } + return parameterToMultiValueMap(collectionFormat, name, "[" + StringUtils.collectionToDelimitedString(values, collectionFormat.separator) + "]"); + } + + /** + * Converts a parameter to a {@link MultiValueMap} for use in REST requests + * @param collectionFormat The format to convert to + * @param name The name of the parameter + * @param value The parameter's value + * @return a Map containing the String value(s) of the input parameter + */ + public MultiValueMap parameterToMultiValueMap(CollectionFormat collectionFormat, String name, Object value) { + final MultiValueMap params = new LinkedMultiValueMap<>(); + + if (name == null || name.isEmpty() || value == null) { + return params; + } + + if(collectionFormat == null) { + collectionFormat = CollectionFormat.CSV; + } + + if (value instanceof Map) { + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + for (final Entry entry : valuesMap.entrySet()) { + params.add(entry.getKey(), parameterToString(entry.getValue())); + } + return params; + } + + Collection valueCollection = null; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(name, parameterToString(value)); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + if (collectionFormat.equals(CollectionFormat.MULTI)) { + for (Object item : valueCollection) { + params.add(name, parameterToString(item)); + } + return params; + } + + List values = new ArrayList<>(); + for(Object o : valueCollection) { + values.add(parameterToString(o)); + } + params.add(name, collectionFormat.collectionToString(values)); + + return params; + } + + /** + * Check if the given {@code String} is a JSON MIME. + * @param mediaType the input MediaType + * @return boolean true if the MediaType represents JSON, false otherwise + */ + public boolean isJsonMime(String mediaType) { + // "* / *" is default to JSON + if ("*/*".equals(mediaType)) { + return true; + } + + try { + return isJsonMime(MediaType.parseMediaType(mediaType)); + } catch (InvalidMediaTypeException e) { + } + return false; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * @param mediaType the input MediaType + * @return boolean true if the MediaType represents JSON, false otherwise + */ + public boolean isJsonMime(MediaType mediaType) { + return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*(\\+json|ndjson)[;]?\\s*$")); + } + + /** + * Check if the given {@code String} is a Problem JSON MIME (RFC-7807). + * @param mediaType the input MediaType + * @return boolean true if the MediaType represents Problem JSON, false otherwise + */ + public boolean isProblemJsonMime(String mediaType) { + return "application/problem+json".equalsIgnoreCase(mediaType); + } + + /** + * 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 List The list of MediaTypes to use for the Accept header + */ + public List selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + MediaType mediaType = MediaType.parseMediaType(accept); + if (isJsonMime(mediaType) && !isProblemJsonMime(accept)) { + return Collections.singletonList(mediaType); + } + } + return MediaType.parseMediaTypes(StringUtils.arrayToCommaDelimitedString(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 non-wildcard one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return MediaType The Content-Type header to use. If the given array is empty, null will be returned; if it only contains wildcard media types, JSON will be used. + */ + public MediaType selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + for (String contentType : contentTypes) { + MediaType mediaType = MediaType.parseMediaType(contentType); + if (isJsonMime(mediaType)) { + // A wildcard media type (e.g. "*/*" or "application/*") is treated as + // JSON-compatible but cannot be used as a request Content-Type header, + // so fall back to concrete JSON in that case. + return mediaType.isWildcardType() || mediaType.isWildcardSubtype() ? MediaType.APPLICATION_JSON : mediaType; + } + } + // No JSON type found; use the first concrete (non-wildcard) media type instead. + for (String contentType : contentTypes) { + MediaType mediaType = MediaType.parseMediaType(contentType); + if (!mediaType.isWildcardType() && !mediaType.isWildcardSubtype()) { + return mediaType; + } + } + return MediaType.APPLICATION_JSON; + } + + /** + * Select the body to use for the request + * + * @param obj the body object + * @param formParams the form parameters + * @param contentType the content type of the request + * @return Object the selected body + */ + protected Object selectBody(Object obj, MultiValueMap formParams, MediaType contentType) { + boolean isForm = MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType) || MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType); + return isForm ? formParams : obj; + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param the return type to use + * @param path The sub-path of the HTTP URL + * @param method The request method + * @param pathParams The path parameters + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @return The response body in chosen type + */ + public ResponseSpec invokeAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { + final RestClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames); + return requestBuilder.retrieve(); + } + + /** + * Include queryParams in uriParams taking into account the paramName + * @param queryParams The query parameters + * @param uriParams The path parameters + * return templatized query string + */ + protected String generateQueryUri(MultiValueMap queryParams, Map uriParams) { + StringBuilder queryBuilder = new StringBuilder(); + queryParams.forEach((name, values) -> { + if (CollectionUtils.isEmpty(values)) { + if (queryBuilder.length() != 0) { + queryBuilder.append('&'); + } + queryBuilder.append(name); + } else { + int valueItemCounter = 0; + for (Object value : values) { + if (queryBuilder.length() != 0) { + queryBuilder.append('&'); + } + queryBuilder.append(name); + if (value != null) { + String templatizedKey = name + valueItemCounter++; + uriParams.put(templatizedKey, value.toString()); + queryBuilder.append('=').append("{").append(templatizedKey).append("}"); + } + } + } + }); + return queryBuilder.toString(); + } + + protected RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map pathParams, + MultiValueMap queryParams, Object body, HttpHeaders headerParams, + MultiValueMap cookieParams, MultiValueMap formParams, List accept, + MediaType contentType, String[] authNames) { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + String baseUrl = basePath; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseUrl = servers.get(serverIndex).URL(serverVariables); + } + + final UriComponentsBuilder builder = UriComponentsBuilder + .fromUriString(baseUrl) + .path(path); + + String finalUri = builder.build(false).toUriString(); + Map uriParams = new HashMap<>(); + uriParams.putAll(pathParams); + + if (queryParams != null && !queryParams.isEmpty()) { + //Include queryParams in uriParams taking into account the paramName + String queryUri = generateQueryUri(queryParams, uriParams); + //Append to finalUri the templatized query string like "?param1={param1Value}&....... + finalUri += "?" + queryUri; + } + + final RestClient.RequestBodySpec requestBuilder = restClient.method(method).uri(finalUri, uriParams); + + if (accept != null) { + requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); + } + if(contentType != null) { + requestBuilder.contentType(contentType); + } + + addHeadersToRequest(headerParams, requestBuilder); + addHeadersToRequest(defaultHeaders, requestBuilder); + addCookiesToRequest(cookieParams, requestBuilder); + addCookiesToRequest(defaultCookies, requestBuilder); + + if (MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType)) { + formParams.forEach( + (k, v) -> { + if (v instanceof java.util.ArrayList && !v.isEmpty()) { + Object first = v.get(0); + if (first != null && first.getClass().isEnum()) { + v.set(0, first.toString()); + } + } + }); + } + + var selectedBody = selectBody(body, formParams, contentType); + if (selectedBody != null) { + requestBuilder.body(selectedBody); + } + + return requestBuilder; + } + + /** + * Add headers to the request that is being built + * @param headers The headers to add + * @param requestBuilder The current request + */ + protected void addHeadersToRequest(HttpHeaders headers, RestClient.RequestBodySpec requestBuilder) { + for (Entry> entry : headers.headerSet()) { + List values = entry.getValue(); + for(String value : values) { + if (value != null) { + requestBuilder.header(entry.getKey(), value); + } + } + } + } + + /** + * Add cookies to the request that is being built + * + * @param cookies The cookies to add + * @param requestBuilder The current request + */ + protected void addCookiesToRequest(MultiValueMap cookies, RestClient.RequestBodySpec requestBuilder) { + if (!cookies.isEmpty()) { + requestBuilder.header("Cookie", buildCookieHeader(cookies)); + } + } + + /** + * Build cookie header. Keeps a single value per cookie (as per + * RFC6265 section 5.3). + * + * @param cookies map all cookies + * @return header string for cookies. + */ + protected String buildCookieHeader(MultiValueMap cookies) { + final StringBuilder cookieValue = new StringBuilder(); + String delimiter = ""; + for (final Map.Entry> entry : cookies.entrySet()) { + final String value = entry.getValue().get(entry.getValue().size() - 1); + cookieValue.append(String.format(java.util.Locale.ROOT, "%s%s=%s", delimiter, entry.getKey(), value)); + delimiter = "; "; + } + return cookieValue.toString(); + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams The query parameters + * @param headerParams The header parameters + * @param cookieParams the cookie parameters + */ + protected void updateParamsForAuth(String[] authNames, MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw exceptionProvider.undefinedAuthenticationException(authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param values The values of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(CollectionFormat collectionFormat, Collection values) { + // create the value based on the collection format + if (CollectionFormat.MULTI.equals(collectionFormat)) { + // not valid for path params + return parameterToString(values); + } + + // collectionFormat is assumed to be "csv" by default + if(collectionFormat == null) { + collectionFormat = CollectionFormat.CSV; + } + + return collectionFormat.collectionToString(values); + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/JavaTimeFormatter.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/JavaTimeFormatter.java new file mode 100644 index 000000000000..54a7a8d404d1 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/JavaTimeFormatter.java @@ -0,0 +1,68 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +/** + * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. + * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class JavaTimeFormatter { + private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + + /** + * Get the date format used to parse/format {@code OffsetDateTime} parameters. + * + * @return DateTimeFormatter + */ + public DateTimeFormatter getOffsetDateTimeFormatter() { + return offsetDateTimeFormatter; + } + + /** + * Set the date format used to parse/format {@code OffsetDateTime} parameters. + * + * @param offsetDateTimeFormatter {@code DateTimeFormatter} + */ + public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) { + this.offsetDateTimeFormatter = offsetDateTimeFormatter; + } + + /** + * Parse the given string into {@code OffsetDateTime} object. + * + * @param str String + * @return {@code OffsetDateTime} + */ + public OffsetDateTime parseOffsetDateTime(String str) { + try { + return OffsetDateTime.parse(str, offsetDateTimeFormatter); + } catch (DateTimeParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given {@code OffsetDateTime} object into string. + * + * @param offsetDateTime {@code OffsetDateTime} + * @return {@code OffsetDateTime} in string format + */ + public String formatOffsetDateTime(OffsetDateTime offsetDateTime) { + return offsetDateTimeFormatter.format(offsetDateTime); + } +} \ No newline at end of file diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..fed104befd6e --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,57 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; +import com.fasterxml.jackson.databind.util.StdDateFormat; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java new file mode 100644 index 000000000000..ab2041ab4a7c --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -0,0 +1,100 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java new file mode 100644 index 000000000000..fe0bb9f03e84 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java @@ -0,0 +1,39 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.Module.SetupContext; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + } + + @Override + public void setupModule(SetupContext context) { + super.setupModule(context); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } + +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..5fc5898f6602 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..ceb86d1b3a4c --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..0dee3a49d407 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Collection; +import java.util.Iterator; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

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

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..eff0bd508420 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,273 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; + +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Beverage; +import org.openapitools.client.model.Fruit; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Arrays; +import java.util.stream.Collectors; + +import org.springframework.core.io.FileSystemResource; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClient.ResponseSpec; +import org.springframework.web.client.RestClientResponseException; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class DefaultApi { + private ApiClient apiClient; + + public DefaultApi() { + this(new ApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * + *

200 - OK + * @param animal The animal parameter + * @return Animal + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec createAnimalRequestCreation(@jakarta.annotation.Nonnull Animal animal) throws RestClientResponseException { + Object postBody = animal; + // verify the required parameter 'animal' is set + if (animal == null) { + throw new RestClientResponseException("Missing the required parameter 'animal' when calling createAnimal", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/json" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/animals", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param animal The animal parameter + * @return Animal + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public Animal createAnimal(@jakarta.annotation.Nonnull Animal animal) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return createAnimalRequestCreation(animal).body(localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param animal The animal parameter + * @return ResponseEntity<Animal> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity createAnimalWithHttpInfo(@jakarta.annotation.Nonnull Animal animal) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return createAnimalRequestCreation(animal).toEntity(localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param animal The animal parameter + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec createAnimalWithResponseSpec(@jakarta.annotation.Nonnull Animal animal) throws RestClientResponseException { + return createAnimalRequestCreation(animal); + } + + /** + * + * + *

200 - OK + * @param beverage The beverage parameter + * @return Beverage + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec createBeverageRequestCreation(@jakarta.annotation.Nonnull Beverage beverage) throws RestClientResponseException { + Object postBody = beverage; + // verify the required parameter 'beverage' is set + if (beverage == null) { + throw new RestClientResponseException("Missing the required parameter 'beverage' when calling createBeverage", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/json" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/beverages", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param beverage The beverage parameter + * @return Beverage + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public Beverage createBeverage(@jakarta.annotation.Nonnull Beverage beverage) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return createBeverageRequestCreation(beverage).body(localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param beverage The beverage parameter + * @return ResponseEntity<Beverage> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity createBeverageWithHttpInfo(@jakarta.annotation.Nonnull Beverage beverage) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return createBeverageRequestCreation(beverage).toEntity(localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param beverage The beverage parameter + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec createBeverageWithResponseSpec(@jakarta.annotation.Nonnull Beverage beverage) throws RestClientResponseException { + return createBeverageRequestCreation(beverage); + } + + /** + * + * + *

200 - OK + * @param fruit The fruit parameter + * @return Fruit + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec createFruitRequestCreation(@jakarta.annotation.Nonnull Fruit fruit) throws RestClientResponseException { + Object postBody = fruit; + // verify the required parameter 'fruit' is set + if (fruit == null) { + throw new RestClientResponseException("Missing the required parameter 'fruit' when calling createFruit", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/json" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/fruits", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param fruit The fruit parameter + * @return Fruit + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public Fruit createFruit(@jakarta.annotation.Nonnull Fruit fruit) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return createFruitRequestCreation(fruit).body(localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param fruit The fruit parameter + * @return ResponseEntity<Fruit> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity createFruitWithHttpInfo(@jakarta.annotation.Nonnull Fruit fruit) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return createFruitRequestCreation(fruit).toEntity(localVarReturnType); + } + + /** + * + * + *

200 - OK + * @param fruit The fruit parameter + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec createFruitWithResponseSpec(@jakarta.annotation.Nonnull Fruit fruit) throws RestClientResponseException { + return createFruitRequestCreation(fruit); + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..d67b5254811d --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,75 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if (location.equals("query")) { + queryParams.add(paramName, value); + } else if (location.equals("header")) { + headerParams.add(paramName, value); + } else if (location.equals("cookie")) { + cookieParams.add(paramName, value); + } + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..1f014a59da85 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,29 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public interface Authentication { + /** + * Apply authentication settings to header and / or query parameters. + * + * @param queryParams The query parameters for the request + * @param headerParams The header parameters for the request + * @param cookieParams The cookie parameters for the request + */ + void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams); +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..a54a4747c8ac --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,51 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..beb1c5d166c2 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,69 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import java.util.Optional; +import java.util.function.Supplier; +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class HttpBearerAuth implements Authentication { + private final String scheme; + private Supplier tokenSupplier; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return tokenSupplier.get(); + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); + if (bearerToken == null) { + return; + } + headerParams.add(HttpHeaders.AUTHORIZATION, (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..46f5e56a37c5 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,41 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class), + @JsonSubTypes.Type(value = Cat.class) +}) + +public interface Animal { +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Apple.java new file mode 100644 index 000000000000..9d63a0c12ad6 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Apple.java @@ -0,0 +1,138 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Apple + */ +@JsonPropertyOrder({ + Apple.JSON_PROPERTY_FRUIT_TYPE, + Apple.JSON_PROPERTY_SEEDS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Apple implements Fruit { + public static final String JSON_PROPERTY_FRUIT_TYPE = "fruitType"; + @jakarta.annotation.Nonnull + private String fruitType; + + public static final String JSON_PROPERTY_SEEDS = "seeds"; + @jakarta.annotation.Nullable + private Integer seeds; + + public Apple() { + } + + public Apple fruitType(@jakarta.annotation.Nonnull String fruitType) { + + this.fruitType = fruitType; + return this; + } + + /** + * Get fruitType + * @return fruitType + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_FRUIT_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getFruitType() { + return fruitType; + } + + + @JsonProperty(value = JSON_PROPERTY_FRUIT_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFruitType(@jakarta.annotation.Nonnull String fruitType) { + this.fruitType = fruitType; + } + + public Apple seeds(@jakarta.annotation.Nullable Integer seeds) { + + this.seeds = seeds; + return this; + } + + /** + * Get seeds + * @return seeds + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SEEDS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSeeds() { + return seeds; + } + + + @JsonProperty(value = JSON_PROPERTY_SEEDS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSeeds(@jakarta.annotation.Nullable Integer seeds) { + this.seeds = seeds; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Apple apple = (Apple) o; + return Objects.equals(this.fruitType, apple.fruitType) && + Objects.equals(this.seeds, apple.seeds); + } + + @Override + public int hashCode() { + return Objects.hash(fruitType, seeds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Apple {\n"); + sb.append(" fruitType: ").append(toIndentedString(fruitType)).append("\n"); + sb.append(" seeds: ").append(toIndentedString(seeds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Banana.java new file mode 100644 index 000000000000..eaaf9d1b4728 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Banana.java @@ -0,0 +1,138 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Banana + */ +@JsonPropertyOrder({ + Banana.JSON_PROPERTY_FRUIT_TYPE, + Banana.JSON_PROPERTY_LENGTH +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Banana implements Fruit { + public static final String JSON_PROPERTY_FRUIT_TYPE = "fruitType"; + @jakarta.annotation.Nonnull + private String fruitType; + + public static final String JSON_PROPERTY_LENGTH = "length"; + @jakarta.annotation.Nullable + private Integer length; + + public Banana() { + } + + public Banana fruitType(@jakarta.annotation.Nonnull String fruitType) { + + this.fruitType = fruitType; + return this; + } + + /** + * Get fruitType + * @return fruitType + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_FRUIT_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getFruitType() { + return fruitType; + } + + + @JsonProperty(value = JSON_PROPERTY_FRUIT_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFruitType(@jakarta.annotation.Nonnull String fruitType) { + this.fruitType = fruitType; + } + + public Banana length(@jakarta.annotation.Nullable Integer length) { + + this.length = length; + return this; + } + + /** + * Get length + * @return length + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_LENGTH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getLength() { + return length; + } + + + @JsonProperty(value = JSON_PROPERTY_LENGTH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLength(@jakarta.annotation.Nullable Integer length) { + this.length = length; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Banana banana = (Banana) o; + return Objects.equals(this.fruitType, banana.fruitType) && + Objects.equals(this.length, banana.length); + } + + @Override + public int hashCode() { + return Objects.hash(fruitType, length); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banana {\n"); + sb.append(" fruitType: ").append(toIndentedString(fruitType)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Beverage.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Beverage.java new file mode 100644 index 000000000000..bb871e978af8 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Beverage.java @@ -0,0 +1,46 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Soda; +import org.openapitools.client.model.Water; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "beverageType", // ignore manually set beverageType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the beverageType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "beverageType", visible = true, defaultImpl = Water.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Soda.class, name = "SODA"), + @JsonSubTypes.Type(value = Water.class, name = "WATER"), +}) + +public interface Beverage { + public String getBeverageType(); +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..3f4bef88ce43 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,103 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Cat implements Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + @jakarta.annotation.Nullable + private Boolean declawed; + + public Cat() { + } + + public Cat declawed(@jakarta.annotation.Nullable Boolean declawed) { + + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DECLAWED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + @JsonProperty(value = JSON_PROPERTY_DECLAWED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeclawed(@jakarta.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..dd668d94ac83 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,103 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BARK +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Dog implements Animal { + public static final String JSON_PROPERTY_BARK = "bark"; + @jakarta.annotation.Nullable + private Boolean bark; + + public Dog() { + } + + public Dog bark(@jakarta.annotation.Nullable Boolean bark) { + + this.bark = bark; + return this; + } + + /** + * Get bark + * @return bark + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BARK, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getBark() { + return bark; + } + + + @JsonProperty(value = JSON_PROPERTY_BARK, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBark(@jakarta.annotation.Nullable Boolean bark) { + this.bark = bark; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.bark, dog.bark); + } + + @Override + public int hashCode() { + return Objects.hash(bark); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" bark: ").append(toIndentedString(bark)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Fruit.java new file mode 100644 index 000000000000..5b535d8f5651 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Fruit.java @@ -0,0 +1,46 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "fruitType", // ignore manually set fruitType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the fruitType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fruitType", visible = true, defaultImpl = Apple.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Apple.class, name = "APPLE"), + @JsonSubTypes.Type(value = Banana.class, name = "BANANA"), +}) + +public interface Fruit { + public String getFruitType(); +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Soda.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Soda.java new file mode 100644 index 000000000000..911ca94d7c75 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Soda.java @@ -0,0 +1,138 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Soda + */ +@JsonPropertyOrder({ + Soda.JSON_PROPERTY_BEVERAGE_TYPE, + Soda.JSON_PROPERTY_SUGAR_GRAMS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Soda implements Beverage { + public static final String JSON_PROPERTY_BEVERAGE_TYPE = "beverageType"; + @jakarta.annotation.Nonnull + private String beverageType; + + public static final String JSON_PROPERTY_SUGAR_GRAMS = "sugarGrams"; + @jakarta.annotation.Nullable + private Integer sugarGrams; + + public Soda() { + } + + public Soda beverageType(@jakarta.annotation.Nonnull String beverageType) { + + this.beverageType = beverageType; + return this; + } + + /** + * Get beverageType + * @return beverageType + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_BEVERAGE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getBeverageType() { + return beverageType; + } + + + @JsonProperty(value = JSON_PROPERTY_BEVERAGE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBeverageType(@jakarta.annotation.Nonnull String beverageType) { + this.beverageType = beverageType; + } + + public Soda sugarGrams(@jakarta.annotation.Nullable Integer sugarGrams) { + + this.sugarGrams = sugarGrams; + return this; + } + + /** + * Get sugarGrams + * @return sugarGrams + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SUGAR_GRAMS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSugarGrams() { + return sugarGrams; + } + + + @JsonProperty(value = JSON_PROPERTY_SUGAR_GRAMS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSugarGrams(@jakarta.annotation.Nullable Integer sugarGrams) { + this.sugarGrams = sugarGrams; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Soda soda = (Soda) o; + return Objects.equals(this.beverageType, soda.beverageType) && + Objects.equals(this.sugarGrams, soda.sugarGrams); + } + + @Override + public int hashCode() { + return Objects.hash(beverageType, sugarGrams); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" beverageType: ").append(toIndentedString(beverageType)).append("\n"); + sb.append(" sugarGrams: ").append(toIndentedString(sugarGrams)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Water.java b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Water.java new file mode 100644 index 000000000000..13fac34b6d14 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/main/java/org/openapitools/client/model/Water.java @@ -0,0 +1,138 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Water + */ +@JsonPropertyOrder({ + Water.JSON_PROPERTY_BEVERAGE_TYPE, + Water.JSON_PROPERTY_SPARKLING +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Water implements Beverage { + public static final String JSON_PROPERTY_BEVERAGE_TYPE = "beverageType"; + @jakarta.annotation.Nonnull + private String beverageType; + + public static final String JSON_PROPERTY_SPARKLING = "sparkling"; + @jakarta.annotation.Nullable + private Boolean sparkling; + + public Water() { + } + + public Water beverageType(@jakarta.annotation.Nonnull String beverageType) { + + this.beverageType = beverageType; + return this; + } + + /** + * Get beverageType + * @return beverageType + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_BEVERAGE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getBeverageType() { + return beverageType; + } + + + @JsonProperty(value = JSON_PROPERTY_BEVERAGE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBeverageType(@jakarta.annotation.Nonnull String beverageType) { + this.beverageType = beverageType; + } + + public Water sparkling(@jakarta.annotation.Nullable Boolean sparkling) { + + this.sparkling = sparkling; + return this; + } + + /** + * Get sparkling + * @return sparkling + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SPARKLING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSparkling() { + return sparkling; + } + + + @JsonProperty(value = JSON_PROPERTY_SPARKLING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSparkling(@jakarta.annotation.Nullable Boolean sparkling) { + this.sparkling = sparkling; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Water water = (Water) o; + return Objects.equals(this.beverageType, water.beverageType) && + Objects.equals(this.sparkling, water.sparkling); + } + + @Override + public int hashCode() { + return Objects.hash(beverageType, sparkling); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Water {\n"); + sb.append(" beverageType: ").append(toIndentedString(beverageType)).append("\n"); + sb.append(" sparkling: ").append(toIndentedString(sparkling)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..15f2ff6833b6 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,76 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Beverage; +import org.openapitools.client.model.Fruit; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + + /** + * + * + * + */ + @Test + public void createAnimalTest() { + Animal animal = null; + Animal response = api.createAnimal(animal); + + // TODO: test validations + } + + /** + * + * + * + */ + @Test + public void createBeverageTest() { + Beverage beverage = null; + Beverage response = api.createBeverage(beverage); + + // TODO: test validations + } + + /** + * + * + * + */ + @Test + public void createFruitTest() { + Fruit fruit = null; + Fruit response = api.createFruit(fruit); + + // TODO: test validations + } + +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..642b7101ecbf --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,34 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +class AnimalTest { +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/AppleTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/AppleTest.java new file mode 100644 index 000000000000..95b3a1688fe2 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/AppleTest.java @@ -0,0 +1,50 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Apple + */ +class AppleTest { + private final Apple model = new Apple(); + + /** + * Model tests for Apple + */ + @Test + void testApple() { + // TODO: test Apple + } + + /** + * Test the property 'seeds' + */ + @Test + void seedsTest() { + // TODO: test seeds + } + +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/BananaTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/BananaTest.java new file mode 100644 index 000000000000..76a04e5047b3 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/BananaTest.java @@ -0,0 +1,50 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Banana + */ +class BananaTest { + private final Banana model = new Banana(); + + /** + * Model tests for Banana + */ + @Test + void testBanana() { + // TODO: test Banana + } + + /** + * Test the property 'length' + */ + @Test + void lengthTest() { + // TODO: test length + } + +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/BeverageTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/BeverageTest.java new file mode 100644 index 000000000000..cda5e3bd9b31 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/BeverageTest.java @@ -0,0 +1,34 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Soda; +import org.openapitools.client.model.Water; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Beverage + */ +class BeverageTest { +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..7b405adc7262 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,47 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'declawed' + */ + @Test + void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..bc7dcaae7e8a --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,47 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'bark' + */ + @Test + void barkTest() { + // TODO: test bark + } + +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/FruitTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/FruitTest.java new file mode 100644 index 000000000000..e199cd7b473b --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/FruitTest.java @@ -0,0 +1,34 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Fruit + */ +class FruitTest { +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/SodaTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/SodaTest.java new file mode 100644 index 000000000000..f9cf3755c336 --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/SodaTest.java @@ -0,0 +1,50 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Soda + */ +class SodaTest { + private final Soda model = new Soda(); + + /** + * Model tests for Soda + */ + @Test + void testSoda() { + // TODO: test Soda + } + + /** + * Test the property 'sugarGrams' + */ + @Test + void sugarGramsTest() { + // TODO: test sugarGrams + } + +} diff --git a/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/WaterTest.java b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/WaterTest.java new file mode 100644 index 000000000000..d22b1f3184bc --- /dev/null +++ b/samples/client/others/java/restclient-jackson-default-impl/src/test/java/org/openapitools/client/model/WaterTest.java @@ -0,0 +1,50 @@ +/* + * Jackson defaultImpl oneOf sample + * Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Water + */ +class WaterTest { + private final Water model = new Water(); + + /** + * Model tests for Water + */ + @Test + void testWater() { + // TODO: test Water + } + + /** + * Test the property 'sparkling' + */ + @Test + void sparklingTest() { + // TODO: test sparkling + } + +} diff --git a/samples/client/others/java/restclient-sealedInterface/build.gradle b/samples/client/others/java/restclient-sealedInterface/build.gradle index 8052bd66f3d6..b27426226f1b 100644 --- a/samples/client/others/java/restclient-sealedInterface/build.gradle +++ b/samples/client/others/java/restclient-sealedInterface/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/others/java/restclient-useAbstractionForFiles/build.gradle b/samples/client/others/java/restclient-useAbstractionForFiles/build.gradle index 310e4d0d5ac2..af2f333788da 100644 --- a/samples/client/others/java/restclient-useAbstractionForFiles/build.gradle +++ b/samples/client/others/java/restclient-useAbstractionForFiles/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/others/java/resttemplate-list-schema-validation/build.gradle b/samples/client/others/java/resttemplate-list-schema-validation/build.gradle index ff82bfe6a4a8..58ced64f3746 100644 --- a/samples/client/others/java/resttemplate-list-schema-validation/build.gradle +++ b/samples/client/others/java/resttemplate-list-schema-validation/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "5.3.33" + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "5.3.33" - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/others/java/resttemplate-useAbstractionForFiles/build.gradle b/samples/client/others/java/resttemplate-useAbstractionForFiles/build.gradle index 02b5b7be0049..cdb26ae36d83 100644 --- a/samples/client/others/java/resttemplate-useAbstractionForFiles/build.gradle +++ b/samples/client/others/java/resttemplate-useAbstractionForFiles/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "5.3.33" + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "5.3.33" - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/others/java/webclient-sealedInterface/build.gradle b/samples/client/others/java/webclient-sealedInterface/build.gradle index 884481be5dbd..22a323e94b80 100644 --- a/samples/client/others/java/webclient-sealedInterface/build.gradle +++ b/samples/client/others/java/webclient-sealedInterface/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + reactor_version = "3.4.34" + reactor_netty_version = "1.2.8" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,18 +125,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "2.7.17" - jakarta_annotation_version = "1.3.5" - beanvalidation_version = "2.0.2" - reactor_version = "3.4.34" - reactor_netty_version = "1.2.8" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" diff --git a/samples/client/others/java/webclient-sealedInterface_3_1/build.gradle b/samples/client/others/java/webclient-sealedInterface_3_1/build.gradle index 884481be5dbd..22a323e94b80 100644 --- a/samples/client/others/java/webclient-sealedInterface_3_1/build.gradle +++ b/samples/client/others/java/webclient-sealedInterface_3_1/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + reactor_version = "3.4.34" + reactor_netty_version = "1.2.8" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,18 +125,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "2.7.17" - jakarta_annotation_version = "1.3.5" - beanvalidation_version = "2.0.2" - reactor_version = "3.4.34" - reactor_netty_version = "1.2.8" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" diff --git a/samples/client/others/java/webclient-useAbstractionForFiles/build.gradle b/samples/client/others/java/webclient-useAbstractionForFiles/build.gradle index 3427a2abea88..bfcdbf3d24f0 100644 --- a/samples/client/others/java/webclient-useAbstractionForFiles/build.gradle +++ b/samples/client/others/java/webclient-useAbstractionForFiles/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + reactor_version = "3.4.34" + reactor_netty_version = "1.2.8" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,18 +125,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "2.7.17" - jakarta_annotation_version = "1.3.5" - beanvalidation_version = "2.0.2" - reactor_version = "3.4.34" - reactor_netty_version = "1.2.8" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator-ignore b/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator/FILES b/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator/FILES new file mode 100644 index 000000000000..10e1864e0a8b --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator/FILES @@ -0,0 +1,31 @@ +README.md +build.gradle +docs/Animal.md +docs/Apple.md +docs/Banana.md +docs/Beverage.md +docs/Cat.md +docs/DefaultApi.md +docs/Dog.md +docs/Fruit.md +docs/Soda.md +docs/Water.md +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +settings.gradle +src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt +src/main/kotlin/org/openapitools/client/infrastructure/ResponseExt.kt +src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +src/main/kotlin/org/openapitools/client/models/Animal.kt +src/main/kotlin/org/openapitools/client/models/Apple.kt +src/main/kotlin/org/openapitools/client/models/Banana.kt +src/main/kotlin/org/openapitools/client/models/Beverage.kt +src/main/kotlin/org/openapitools/client/models/Cat.kt +src/main/kotlin/org/openapitools/client/models/Dog.kt +src/main/kotlin/org/openapitools/client/models/Fruit.kt +src/main/kotlin/org/openapitools/client/models/Soda.kt +src/main/kotlin/org/openapitools/client/models/Water.kt diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator/VERSION b/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator/VERSION new file mode 100644 index 000000000000..8fc8df61083a --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.25.0-SNAPSHOT diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/README.md b/samples/client/others/kotlin-oneof-jackson-default-impl/README.md new file mode 100644 index 000000000000..6c35694dccf1 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/README.md @@ -0,0 +1,72 @@ +# org.openapitools.client - Kotlin client library for Jackson defaultImpl oneOf sample + +Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.0.1 +- Package version: +- Generator version: 7.25.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + +## Requires + +* Kotlin 2.4.0 +* Gradle 8.14 + +## Build + +First, create the gradle wrapper script: + +``` +gradle wrapper +``` + +Then, run: + +``` +./gradlew check assemble +``` + +This runs all tests and packages the library. + +## Features/Implementation Notes + +* Supports JSON inputs/outputs, File inputs, and Form inputs. +* Supports collection formats for query parameters: csv, tsv, ssv, pipes. +* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. +* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. + + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:8080* + +| Class | Method | HTTP request | Description | +| ------------ | ------------- | ------------- | ------------- | +| *DefaultApi* | [**createAnimal**](docs/DefaultApi.md#createanimal) | **POST** animals | | +| *DefaultApi* | [**createBeverage**](docs/DefaultApi.md#createbeverage) | **POST** beverages | | +| *DefaultApi* | [**createFruit**](docs/DefaultApi.md#createfruit) | **POST** fruits | | + + + +## Documentation for Models + + - [org.openapitools.client.models.Animal](docs/Animal.md) + - [org.openapitools.client.models.Apple](docs/Apple.md) + - [org.openapitools.client.models.Banana](docs/Banana.md) + - [org.openapitools.client.models.Beverage](docs/Beverage.md) + - [org.openapitools.client.models.Cat](docs/Cat.md) + - [org.openapitools.client.models.Dog](docs/Dog.md) + - [org.openapitools.client.models.Fruit](docs/Fruit.md) + - [org.openapitools.client.models.Soda](docs/Soda.md) + - [org.openapitools.client.models.Water](docs/Water.md) + + + +## Documentation for Authorization + +Endpoints do not require authorization. + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build.gradle b/samples/client/others/kotlin-oneof-jackson-default-impl/build.gradle new file mode 100644 index 000000000000..ed78a5564b4f --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/build.gradle @@ -0,0 +1,81 @@ +group 'org.openapitools' +version '1.0.0' + +wrapper { + gradleVersion = '8.14.5' + distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" +} + +buildscript { + ext.kotlin_version = '2.4.0' + ext.retrofitVersion = '3.0.0' + ext.spotless_version = "7.2.1" + + repositories { + maven { url "https://repo1.maven.org/maven2" } + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" + } +} + +apply plugin: 'kotlin' +apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' + +repositories { + maven { url "https://repo1.maven.org/maven2" } +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + kotlin { + ktfmt() + } +} + +test { + useJUnitPlatform() +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.22.1" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.22.1" + implementation "com.squareup.okhttp3:logging-interceptor:5.4.0" + implementation "com.squareup.retrofit2:retrofit:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-jackson:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" +} + +java { + withSourcesJar() +} + +publishing { + publications { + maven(MavenPublication) { + groupId = 'org.openapitools' + artifactId = 'kotlin-oneof-jackson-default-impl' + version = '1.0.0' + from components.java + } + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/META-INF/kotlin-oneof-jackson-default-impl.kotlin_module b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/META-INF/kotlin-oneof-jackson-default-impl.kotlin_module new file mode 100644 index 000000000000..ef915de2ec8b Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/META-INF/kotlin-oneof-jackson-default-impl.kotlin_module differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/apis/DefaultApi.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/apis/DefaultApi.class new file mode 100644 index 000000000000..72fa482998b6 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/apis/DefaultApi.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$Companion.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$Companion.class new file mode 100644 index 000000000000..44183e882a2b Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$Companion.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient.class new file mode 100644 index 000000000000..6185fa9cfeb6 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$CSVParams.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$CSVParams.class new file mode 100644 index 000000000000..1caef7883028 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$CSVParams.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$PIPESParams.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$PIPESParams.class new file mode 100644 index 000000000000..deff772f575b Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$PIPESParams.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$SPACEParams.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$SPACEParams.class new file mode 100644 index 000000000000..87b58b3cee89 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$SPACEParams.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$SSVParams.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$SSVParams.class new file mode 100644 index 000000000000..301c1163d787 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$SSVParams.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$TSVParams.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$TSVParams.class new file mode 100644 index 000000000000..0d2228d8fe38 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats$TSVParams.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats.class new file mode 100644 index 000000000000..d69409cc94f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/CollectionFormats.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/Serializer.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/Serializer.class new file mode 100644 index 000000000000..622a3586ef6d Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/infrastructure/Serializer.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Animal.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Animal.class new file mode 100644 index 000000000000..a745c8b73d1d Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Animal.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Apple.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Apple.class new file mode 100644 index 000000000000..8679c8da50cd Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Apple.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Banana.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Banana.class new file mode 100644 index 000000000000..4786b4bda59e Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Banana.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Beverage.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Beverage.class new file mode 100644 index 000000000000..f0abef8d07e1 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Beverage.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Cat.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Cat.class new file mode 100644 index 000000000000..90bc4e5f61b9 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Cat.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Dog.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Dog.class new file mode 100644 index 000000000000..7013689759d0 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Dog.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Fruit.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Fruit.class new file mode 100644 index 000000000000..6e3d733be667 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Fruit.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Soda.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Soda.class new file mode 100644 index 000000000000..573187681044 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Soda.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Water.class b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Water.class new file mode 100644 index 000000000000..37139e49112e Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/classes/kotlin/main/org/openapitools/client/models/Water.class differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 000000000000..1d0a59a03353 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 000000000000..cdc661d97007 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 000000000000..86da64f83c6c Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 000000000000..003bc0ebfc32 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 000000000000..073ffeb58d42 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 000000000000..bf17d66dcb49 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab new file mode 100644 index 000000000000..04a0a107e09d Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream new file mode 100644 index 000000000000..e33ef55c53a6 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len new file mode 100644 index 000000000000..161abe026e82 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len new file mode 100644 index 000000000000..14f7c061cc4b Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at new file mode 100644 index 000000000000..c1f99d402668 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i new file mode 100644 index 000000000000..8cd6c2c06cf3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 000000000000..f6b80b8657b3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 000000000000..e33ef55c53a6 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 000000000000..161abe026e82 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 000000000000..14f7c061cc4b Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 000000000000..63a40a3fc10c Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 000000000000..8cd6c2c06cf3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab new file mode 100644 index 000000000000..bdf584a84b58 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream new file mode 100644 index 000000000000..212ae48abe42 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len new file mode 100644 index 000000000000..c32b442ac5e8 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len new file mode 100644 index 000000000000..2a17e6e5bd9e Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at new file mode 100644 index 000000000000..b1a9df70af75 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i new file mode 100644 index 000000000000..28d0f1a654db Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 000000000000..f6b80b8657b3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 000000000000..6f0ee47b384f Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 000000000000..161abe026e82 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 000000000000..14f7c061cc4b Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 000000000000..63a40a3fc10c Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 000000000000..905e8380283a Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 000000000000..ebcd728d0128 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 000000000000..9eacf1d5d798 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 000000000000..5f92aa7216e5 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 000000000000..8fe89d82d540 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 000000000000..81e338243a4d Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 000000000000..185e558c1984 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 000000000000..57e2e772aabc Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 000000000000..cdc661d97007 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 000000000000..86da64f83c6c Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 000000000000..003bc0ebfc32 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 000000000000..6ceb84a00004 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 000000000000..bf17d66dcb49 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 000000000000..25400f81b518 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 000000000000..1d3d2e30c54b Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 000000000000..0241cabce486 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 000000000000..01bdaa1da7d9 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 000000000000..bd26ba9ef2cb Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 000000000000..cdbf1d82f269 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 000000000000..30fa3bac395a Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 000000000000..fbd2f149c09d Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 000000000000..09407efabbe5 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 000000000000..93a595bd1bba Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 000000000000..4634cbee1f1d Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 000000000000..7369ee28c4ac Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/counters.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/counters.tab new file mode 100644 index 000000000000..3a4beb90d34b --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +14 +0 \ No newline at end of file diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 000000000000..6585f9f19e04 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 000000000000..9c33a9198851 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 000000000000..86da64f83c6c Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 000000000000..003bc0ebfc32 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 000000000000..add58948f404 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 000000000000..b16d474357af Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 000000000000..dddd77406fed Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 000000000000..bf06e3766700 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 000000000000..46715fa2fd46 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 000000000000..003bc0ebfc32 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 000000000000..38421d6e2d25 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i new file mode 100644 index 000000000000..a131b895d33f Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab new file mode 100644 index 000000000000..f73a92d5e24a Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 000000000000..48f79fbb9722 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 000000000000..21a0fe254f45 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 000000000000..79208b602e26 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 000000000000..850dbd0f8e98 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab_i b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 000000000000..8de6a35537c5 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab_i differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 000000000000..131e265740f3 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/last-build.bin b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/last-build.bin new file mode 100644 index 000000000000..ccc10d6f11a0 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/cacheable/last-build.bin differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin new file mode 100644 index 000000000000..25b1ce3d1dc1 Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/build/kotlin/compileKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Animal.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Animal.md new file mode 100644 index 000000000000..6c37c4720729 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Animal.md @@ -0,0 +1,11 @@ + +# Animal + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **bark** | **kotlin.Boolean** | | [optional] | +| **declawed** | **kotlin.Boolean** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Apple.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Apple.md new file mode 100644 index 000000000000..383fb22a5244 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Apple.md @@ -0,0 +1,11 @@ + +# Apple + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **fruitType** | **kotlin.String** | | | +| **seeds** | **kotlin.Int** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Banana.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Banana.md new file mode 100644 index 000000000000..810a98ec722e --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Banana.md @@ -0,0 +1,11 @@ + +# Banana + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **fruitType** | **kotlin.String** | | | +| **length** | **kotlin.Int** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Beverage.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Beverage.md new file mode 100644 index 000000000000..a7a9c70225e2 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Beverage.md @@ -0,0 +1,12 @@ + +# Beverage + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **beverageType** | **kotlin.String** | | | +| **sparkling** | **kotlin.Boolean** | | [optional] | +| **sugarGrams** | **kotlin.Int** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Cat.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Cat.md new file mode 100644 index 000000000000..6901dc7d977c --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Cat.md @@ -0,0 +1,10 @@ + +# Cat + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **declawed** | **kotlin.Boolean** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/DefaultApi.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/DefaultApi.md new file mode 100644 index 000000000000..8417be8239ab --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/DefaultApi.md @@ -0,0 +1,116 @@ +# DefaultApi + +All URIs are relative to *http://localhost:8080* + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createAnimal**](DefaultApi.md#createAnimal) | **POST** animals | | +| [**createBeverage**](DefaultApi.md#createBeverage) | **POST** beverages | | +| [**createFruit**](DefaultApi.md#createFruit) | **POST** fruits | | + + + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.* +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiClient = ApiClient() +val webService = apiClient.createWebservice(DefaultApi::class.java) +val animal : Animal = // Animal | + +val result : Animal = webService.createAnimal(animal) +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **animal** | [**Animal**](Animal.md)| | | + +### Return type + +[**Animal**](Animal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.* +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiClient = ApiClient() +val webService = apiClient.createWebservice(DefaultApi::class.java) +val beverage : Beverage = // Beverage | + +val result : Beverage = webService.createBeverage(beverage) +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **beverage** | [**Beverage**](Beverage.md)| | | + +### Return type + +[**Beverage**](Beverage.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.* +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiClient = ApiClient() +val webService = apiClient.createWebservice(DefaultApi::class.java) +val fruit : Fruit = // Fruit | + +val result : Fruit = webService.createFruit(fruit) +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **fruit** | [**Fruit**](Fruit.md)| | | + +### Return type + +[**Fruit**](Fruit.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Dog.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Dog.md new file mode 100644 index 000000000000..8485f7e80dad --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Dog.md @@ -0,0 +1,10 @@ + +# Dog + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **bark** | **kotlin.Boolean** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Fruit.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Fruit.md new file mode 100644 index 000000000000..018541e15299 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Fruit.md @@ -0,0 +1,12 @@ + +# Fruit + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **fruitType** | **kotlin.String** | | | +| **seeds** | **kotlin.Int** | | [optional] | +| **length** | **kotlin.Int** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Soda.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Soda.md new file mode 100644 index 000000000000..7c701f073d09 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Soda.md @@ -0,0 +1,11 @@ + +# Soda + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **beverageType** | **kotlin.String** | | | +| **sugarGrams** | **kotlin.Int** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Water.md b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Water.md new file mode 100644 index 000000000000..adac6b0874a5 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/docs/Water.md @@ -0,0 +1,11 @@ + +# Water + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **beverageType** | **kotlin.String** | | | +| **sparkling** | **kotlin.Boolean** | | [optional] | + + + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar b/samples/client/others/kotlin-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..2c3521197d7c Binary files /dev/null and b/samples/client/others/kotlin-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties b/samples/client/others/kotlin-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..70fe02a53692 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-all.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/gradlew b/samples/client/others/kotlin-oneof-jackson-default-impl/gradlew new file mode 100644 index 000000000000..51eb8bb47109 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/gradlew.bat b/samples/client/others/kotlin-oneof-jackson-default-impl/gradlew.bat new file mode 100644 index 000000000000..9d21a21834d5 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/gradlew.bat @@ -0,0 +1,94 @@ +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/settings.gradle b/samples/client/others/kotlin-oneof-jackson-default-impl/settings.gradle new file mode 100644 index 000000000000..fbacb1bd89a5 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'kotlin-oneof-jackson-default-impl' diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt new file mode 100644 index 000000000000..1abd1a24186d --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -0,0 +1,53 @@ +package org.openapitools.client.apis + +import org.openapitools.client.infrastructure.CollectionFormats.* +import retrofit2.http.* +import retrofit2.Call +import okhttp3.RequestBody +import com.fasterxml.jackson.annotation.JsonProperty + +import org.openapitools.client.models.Animal +import org.openapitools.client.models.Beverage +import org.openapitools.client.models.Fruit + +interface DefaultApi { + /** + * POST animals + * + * + * Responses: + * - 200: OK + * + * @param animal + * @return [Call]<[Animal]> + */ + @POST("animals") + fun createAnimal(@Body animal: Animal): Call + + /** + * POST beverages + * + * + * Responses: + * - 200: OK + * + * @param beverage + * @return [Call]<[Beverage]> + */ + @POST("beverages") + fun createBeverage(@Body beverage: Beverage): Call + + /** + * POST fruits + * + * + * Responses: + * - 200: OK + * + * @param fruit + * @return [Call]<[Fruit]> + */ + @POST("fruits") + fun createFruit(@Body fruit: Fruit): Call + +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt new file mode 100644 index 000000000000..dc406de1531a --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -0,0 +1,115 @@ +package org.openapitools.client.infrastructure + + +import okhttp3.Call +import okhttp3.Interceptor +import okhttp3.OkHttpClient +import retrofit2.Retrofit +import okhttp3.logging.HttpLoggingInterceptor +import retrofit2.Converter +import retrofit2.CallAdapter +import retrofit2.converter.scalars.ScalarsConverterFactory +import com.fasterxml.jackson.databind.ObjectMapper +import retrofit2.converter.jackson.JacksonConverterFactory + + +class ApiClient( + private var baseUrl: String = defaultBasePath, + private val okHttpClientBuilder: OkHttpClient.Builder? = null, + private val serializerBuilder: ObjectMapper = Serializer.jacksonObjectMapper, + private val callFactory: Call.Factory? = null, + private val callAdapterFactories: List = listOf( + ), + private val converterFactories: List = listOf( + ScalarsConverterFactory.create(), + JacksonConverterFactory.create(serializerBuilder), + ) +) { + private val apiAuthorizations = mutableMapOf() + var logger: ((String) -> Unit)? = null + + private val retrofitBuilder: Retrofit.Builder by lazy { + Retrofit.Builder() + .baseUrl(baseUrl) + .apply { + callAdapterFactories.forEach { + addCallAdapterFactory(it) + } + } + .apply { + converterFactories.forEach { + addConverterFactory(it) + } + } + } + + private val clientBuilder: OkHttpClient.Builder by lazy { + okHttpClientBuilder ?: defaultClientBuilder + } + + private val defaultClientBuilder: OkHttpClient.Builder by lazy { + OkHttpClient() + .newBuilder() + .addInterceptor(HttpLoggingInterceptor { message -> logger?.invoke(message) } + .apply { level = HttpLoggingInterceptor.Level.BODY } + ) + } + + init { + normalizeBaseUrl() + } + + /** + * Adds an authorization to be used by the client + * @param authName Authentication name + * @param authorization Authorization interceptor + * @return ApiClient + */ + fun addAuthorization(authName: String, authorization: Interceptor): ApiClient { + if (apiAuthorizations.containsKey(authName)) { + throw RuntimeException("auth name $authName already in api authorizations") + } + apiAuthorizations[authName] = authorization + clientBuilder.addInterceptor(authorization) + return this + } + + fun setLogger(logger: (String) -> Unit): ApiClient { + this.logger = logger + return this + } + + fun createService(serviceClass: Class): S { + val usedCallFactory = this.callFactory ?: clientBuilder.build() + return retrofitBuilder.callFactory(usedCallFactory).build().create(serviceClass) + } + + private fun normalizeBaseUrl() { + if (!baseUrl.endsWith("/")) { + baseUrl += "/" + } + } + + private inline fun Iterable.runOnFirst(callback: U.() -> Unit) { + for (element in this) { + if (element is U) { + callback.invoke(element) + break + } + } + } + + companion object { + protected const val BASE_URL_KEY: String = "org.openapitools.client.baseUrl" + @Deprecated( + message = "Please use the capitalized constant `BASE_URL_KEY` instead.", + replaceWith = ReplaceWith("BASE_URL_KEY") + ) + protected const val baseUrlKey: String = BASE_URL_KEY + + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty(BASE_URL_KEY, "http://localhost:8080") + } + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt new file mode 100644 index 000000000000..7f404da69ea0 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt @@ -0,0 +1,56 @@ +package org.openapitools.client.infrastructure + +class CollectionFormats { + + open class CSVParams { + + var params: List + + constructor(params: List) { + this.params = params + } + + constructor(vararg params: String) { + this.params = listOf(*params) + } + + override fun toString(): String { + return params.joinToString(",") + } + } + + open class SSVParams : CSVParams { + + constructor(params: List) : super(params) + + constructor(vararg params: String) : super(*params) + + override fun toString(): String { + return params.joinToString(" ") + } + } + + class TSVParams : CSVParams { + + constructor(params: List) : super(params) + + constructor(vararg params: String) : super(*params) + + override fun toString(): String { + return params.joinToString("\t") + } + } + + class PIPESParams : CSVParams { + + constructor(params: List) : super(params) + + constructor(vararg params: String) : super(*params) + + override fun toString(): String { + return params.joinToString("|") + } + } + + class SPACEParams : SSVParams() +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExt.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExt.kt new file mode 100644 index 000000000000..0f121a95f5be --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExt.kt @@ -0,0 +1,4 @@ +package org.openapitools.client.infrastructure + +import retrofit2.Response + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt new file mode 100644 index 000000000000..80783430664b --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.infrastructure + +import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.SerializationFeature +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper + +object Serializer { + @JvmStatic + val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper() + .findAndRegisterModules() + .setSerializationInclusion(JsonInclude.Include.NON_ABSENT) + .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true) + .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Animal.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Animal.kt new file mode 100644 index 000000000000..9831903e1cff --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Animal.kt @@ -0,0 +1,54 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Cat +import org.openapitools.client.models.Dog + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param bark + * @param declawed + */ + + +data class Animal ( + + @param:JsonProperty("bark") + @get:JsonProperty("bark") + val bark: kotlin.Boolean? = null, + + @param:JsonProperty("declawed") + @get:JsonProperty("declawed") + val declawed: kotlin.Boolean? = null + +) { + + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Apple.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Apple.kt new file mode 100644 index 000000000000..c1caa3c474b9 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Apple.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param fruitType + * @param seeds + */ + + +data class Apple ( + + @param:JsonProperty("fruitType") + @get:JsonProperty("fruitType") + val fruitType: kotlin.String, + + @param:JsonProperty("seeds") + @get:JsonProperty("seeds") + val seeds: kotlin.Int? = null + +) { + + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Banana.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Banana.kt new file mode 100644 index 000000000000..103d48bf00b0 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Banana.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param fruitType + * @param length + */ + + +data class Banana ( + + @param:JsonProperty("fruitType") + @get:JsonProperty("fruitType") + val fruitType: kotlin.String, + + @param:JsonProperty("length") + @get:JsonProperty("length") + val length: kotlin.Int? = null + +) { + + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Beverage.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Beverage.kt new file mode 100644 index 000000000000..bc82ca1ab1c2 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Beverage.kt @@ -0,0 +1,62 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Soda +import org.openapitools.client.models.Water + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo + +/** + * + * + * @param beverageType + * @param sparkling + * @param sugarGrams + */ +@JsonIgnoreProperties( + value = ["beverageType"], // ignore manually set beverageType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the beverageType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "beverageType", visible = true, defaultImpl = Water::class) +@JsonSubTypes( + JsonSubTypes.Type(value = Soda::class, name = "SODA"), + JsonSubTypes.Type(value = Water::class, name = "WATER") +) + +interface Beverage { + + @get:JsonProperty("beverageType") + val beverageType: kotlin.String + @get:JsonProperty("sparkling") + val sparkling: kotlin.Boolean? + @get:JsonProperty("sugarGrams") + val sugarGrams: kotlin.Int? + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Cat.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Cat.kt new file mode 100644 index 000000000000..ed40c6089e51 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Cat.kt @@ -0,0 +1,47 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param declawed + */ + + +data class Cat ( + + @param:JsonProperty("declawed") + @get:JsonProperty("declawed") + val declawed: kotlin.Boolean? = null + +) { + + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Dog.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Dog.kt new file mode 100644 index 000000000000..02840ba666bd --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Dog.kt @@ -0,0 +1,47 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param bark + */ + + +data class Dog ( + + @param:JsonProperty("bark") + @get:JsonProperty("bark") + val bark: kotlin.Boolean? = null + +) { + + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Fruit.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Fruit.kt new file mode 100644 index 000000000000..a4a64f5e3eef --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Fruit.kt @@ -0,0 +1,62 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Apple +import org.openapitools.client.models.Banana + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo + +/** + * + * + * @param fruitType + * @param seeds + * @param length + */ +@JsonIgnoreProperties( + value = ["fruitType"], // ignore manually set fruitType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the fruitType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fruitType", visible = true, defaultImpl = Apple::class) +@JsonSubTypes( + JsonSubTypes.Type(value = Apple::class, name = "APPLE"), + JsonSubTypes.Type(value = Banana::class, name = "BANANA") +) + +interface Fruit { + + @get:JsonProperty("fruitType") + val fruitType: kotlin.String + @get:JsonProperty("seeds") + val seeds: kotlin.Int? + @get:JsonProperty("length") + val length: kotlin.Int? + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Soda.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Soda.kt new file mode 100644 index 000000000000..33391ff9a169 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Soda.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param beverageType + * @param sugarGrams + */ + + +data class Soda ( + + @param:JsonProperty("beverageType") + @get:JsonProperty("beverageType") + val beverageType: kotlin.String, + + @param:JsonProperty("sugarGrams") + @get:JsonProperty("sugarGrams") + val sugarGrams: kotlin.Int? = null + +) { + + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Water.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Water.kt new file mode 100644 index 000000000000..99a2a042fcda --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/client/models/Water.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param beverageType + * @param sparkling + */ + + +data class Water ( + + @param:JsonProperty("beverageType") + @get:JsonProperty("beverageType") + val beverageType: kotlin.String, + + @param:JsonProperty("sparkling") + @get:JsonProperty("sparkling") + val sparkling: kotlin.Boolean? = null + +) { + + +} + diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/apis/DefaultApiTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/apis/DefaultApiTest.kt new file mode 100644 index 000000000000..cba08eb255f0 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/apis/DefaultApiTest.kt @@ -0,0 +1,64 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.DefaultApi +import org.openapitools.client.models.Animal +import org.openapitools.client.models.Beverage +import org.openapitools.client.models.Fruit + +class DefaultApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of DefaultApi + //val apiInstance = DefaultApi() + + // to test createAnimal + should("test createAnimal") { + // uncomment below to test createAnimal + //val animal : Animal = // Animal | + //val result : Animal = apiInstance.createAnimal(animal) + //result shouldBe ("TODO") + } + + // to test createBeverage + should("test createBeverage") { + // uncomment below to test createBeverage + //val beverage : Beverage = // Beverage | + //val result : Beverage = apiInstance.createBeverage(beverage) + //result shouldBe ("TODO") + } + + // to test createFruit + should("test createFruit") { + // uncomment below to test createFruit + //val fruit : Fruit = // Fruit | + //val result : Fruit = apiInstance.createFruit(fruit) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/AnimalTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/AnimalTest.kt new file mode 100644 index 000000000000..c31bbcdd3461 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/AnimalTest.kt @@ -0,0 +1,51 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Animal +import org.openapitools.client.models.Cat +import org.openapitools.client.models.Dog + +class AnimalTest : ShouldSpec() { + init { + // uncomment below to create an instance of Animal + //val modelInstance = Animal() + + // to test the property `bark` + should("test bark") { + // uncomment below to test the property + //modelInstance.bark shouldBe ("TODO") + } + + // to test the property `declawed` + should("test declawed") { + // uncomment below to test the property + //modelInstance.declawed shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/AppleTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/AppleTest.kt new file mode 100644 index 000000000000..1c832405042e --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/AppleTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Apple + +class AppleTest : ShouldSpec() { + init { + // uncomment below to create an instance of Apple + //val modelInstance = Apple() + + // to test the property `seeds` + should("test seeds") { + // uncomment below to test the property + //modelInstance.seeds shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/BananaTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/BananaTest.kt new file mode 100644 index 000000000000..55d93751d892 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/BananaTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Banana + +class BananaTest : ShouldSpec() { + init { + // uncomment below to create an instance of Banana + //val modelInstance = Banana() + + // to test the property `length` + should("test length") { + // uncomment below to test the property + //modelInstance.length shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/BeverageTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/BeverageTest.kt new file mode 100644 index 000000000000..50319cf7b4ce --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/BeverageTest.kt @@ -0,0 +1,57 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Beverage +import org.openapitools.client.models.Soda +import org.openapitools.client.models.Water + +class BeverageTest : ShouldSpec() { + init { + // uncomment below to create an instance of Beverage + //val modelInstance = Beverage() + + // to test the property `beverageType` + should("test beverageType") { + // uncomment below to test the property + //modelInstance.beverageType shouldBe ("TODO") + } + + // to test the property `sparkling` + should("test sparkling") { + // uncomment below to test the property + //modelInstance.sparkling shouldBe ("TODO") + } + + // to test the property `sugarGrams` + should("test sugarGrams") { + // uncomment below to test the property + //modelInstance.sugarGrams shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/CatTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/CatTest.kt new file mode 100644 index 000000000000..7da9bed8d2ed --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/CatTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Cat + +class CatTest : ShouldSpec() { + init { + // uncomment below to create an instance of Cat + //val modelInstance = Cat() + + // to test the property `declawed` + should("test declawed") { + // uncomment below to test the property + //modelInstance.declawed shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/DogTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/DogTest.kt new file mode 100644 index 000000000000..ccd11a99ebb6 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/DogTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Dog + +class DogTest : ShouldSpec() { + init { + // uncomment below to create an instance of Dog + //val modelInstance = Dog() + + // to test the property `bark` + should("test bark") { + // uncomment below to test the property + //modelInstance.bark shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/FruitTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/FruitTest.kt new file mode 100644 index 000000000000..cbc254be0116 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/FruitTest.kt @@ -0,0 +1,57 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Fruit +import org.openapitools.client.models.Apple +import org.openapitools.client.models.Banana + +class FruitTest : ShouldSpec() { + init { + // uncomment below to create an instance of Fruit + //val modelInstance = Fruit() + + // to test the property `fruitType` + should("test fruitType") { + // uncomment below to test the property + //modelInstance.fruitType shouldBe ("TODO") + } + + // to test the property `seeds` + should("test seeds") { + // uncomment below to test the property + //modelInstance.seeds shouldBe ("TODO") + } + + // to test the property `length` + should("test length") { + // uncomment below to test the property + //modelInstance.length shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/SodaTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/SodaTest.kt new file mode 100644 index 000000000000..414ae09de946 --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/SodaTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Soda + +class SodaTest : ShouldSpec() { + init { + // uncomment below to create an instance of Soda + //val modelInstance = Soda() + + // to test the property `sugarGrams` + should("test sugarGrams") { + // uncomment below to test the property + //modelInstance.sugarGrams shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/WaterTest.kt b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/WaterTest.kt new file mode 100644 index 000000000000..b778fefa7ccd --- /dev/null +++ b/samples/client/others/kotlin-oneof-jackson-default-impl/src/test/kotlin/org/openapitools/client/models/WaterTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Water + +class WaterTest : ShouldSpec() { + init { + // uncomment below to create an instance of Water + //val modelInstance = Water() + + // to test the property `sparkling` + should("test sparkling") { + // uncomment below to test the property + //modelInstance.sparkling shouldBe ("TODO") + } + + } +} diff --git a/samples/client/petstore/java/apache-httpclient-jackson3/build.gradle b/samples/client/petstore/java/apache-httpclient-jackson3/build.gradle index 1a0fae43b234..e4270acb6f8c 100644 --- a/samples/client/petstore/java/apache-httpclient-jackson3/build.gradle +++ b/samples/client/petstore/java/apache-httpclient-jackson3/build.gradle @@ -18,6 +18,17 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.6" + jackson3_version = "3.1.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + httpclient_version = "5.6.3" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -118,17 +129,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.6" - jackson3_version = "3.1.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - httpclient_version = "5.6.3" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/apache-httpclient/build.gradle b/samples/client/petstore/java/apache-httpclient/build.gradle index 5747befa6389..6e33a781bdf4 100644 --- a/samples/client/petstore/java/apache-httpclient/build.gradle +++ b/samples/client/petstore/java/apache-httpclient/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.6" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + httpclient_version = "5.6.3" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -118,18 +130,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.6" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - httpclient_version = "5.6.3" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/feign-hc5/build.gradle b/samples/client/petstore/java/feign-hc5/build.gradle index 776651e0c5f5..281306f52243 100644 --- a/samples/client/petstore/java/feign-hc5/build.gradle +++ b/samples/client/petstore/java/feign-hc5/build.gradle @@ -19,6 +19,19 @@ repositories { } +ext { + swagger_annotations_version = "1.6.11" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + feign_version = "13.5" + feign_form_version = "3.8.0" + junit_version = "5.7.0" + scribejava_version = "8.0.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -102,19 +115,6 @@ test { useJUnitPlatform() } -ext { - swagger_annotations_version = "1.6.11" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - feign_version = "13.5" - feign_form_version = "3.8.0" - junit_version = "5.7.0" - scribejava_version = "8.0.0" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/feign-no-nullable/build.gradle b/samples/client/petstore/java/feign-no-nullable/build.gradle index 86f101c1db7d..8d52fd6e3c98 100644 --- a/samples/client/petstore/java/feign-no-nullable/build.gradle +++ b/samples/client/petstore/java/feign-no-nullable/build.gradle @@ -19,6 +19,19 @@ repositories { } +ext { + swagger_annotations_version = "1.6.11" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jakarta_annotation_version = "1.3.5" + feign_version = "13.5" + feign_form_version = "3.8.0" + junit_version = "5.7.0" + scribejava_version = "8.0.0" + commons_lang3_version = "3.17.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -102,19 +115,6 @@ test { useJUnitPlatform() } -ext { - swagger_annotations_version = "1.6.11" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jakarta_annotation_version = "1.3.5" - feign_version = "13.5" - feign_form_version = "3.8.0" - junit_version = "5.7.0" - scribejava_version = "8.0.0" - commons_lang3_version = "3.17.0" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index 382a7e1d0bb4..056550c465b6 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -19,6 +19,19 @@ repositories { } +ext { + swagger_annotations_version = "1.6.11" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + feign_version = "13.5" + feign_form_version = "3.8.0" + junit_version = "5.7.0" + scribejava_version = "8.0.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -102,19 +115,6 @@ test { useJUnitPlatform() } -ext { - swagger_annotations_version = "1.6.11" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - feign_version = "13.5" - feign_form_version = "3.8.0" - junit_version = "5.7.0" - scribejava_version = "8.0.0" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/google-api-client/build.gradle b/samples/client/petstore/java/google-api-client/build.gradle index 2e62883ad2e7..32fcd93c05da 100644 --- a/samples/client/petstore/java/google-api-client/build.gradle +++ b/samples/client/petstore/java/google-api-client/build.gradle @@ -19,6 +19,19 @@ repositories { } +ext { + swagger_annotations_version = "1.6.3" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + google_api_client_version = "1.32.2" + jersey_common_version = "2.25.1" + jodatime_version = "2.9.9" + junit_version = "4.13.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,19 +111,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.3" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - google_api_client_version = "1.32.2" - jersey_common_version = "2.25.1" - jodatime_version = "2.9.9" - junit_version = "4.13.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle index 114e2db2f08d..84578a550f2d 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle @@ -20,6 +20,17 @@ repositories { mavenCentral() } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" + scribejava_apis_version = "8.3.1" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,17 +110,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" - scribejava_apis_version = "8.3.1" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" diff --git a/samples/client/petstore/java/jersey2-java8/build.gradle b/samples/client/petstore/java/jersey2-java8/build.gradle index 48b6d018e475..70f62ea602a4 100644 --- a/samples/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/client/petstore/java/jersey2-java8/build.gradle @@ -20,6 +20,17 @@ repositories { mavenCentral() } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" + scribejava_apis_version = "8.3.1" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,17 +110,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" - scribejava_apis_version = "8.3.1" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" diff --git a/samples/client/petstore/java/jersey3-jackson3/build.gradle b/samples/client/petstore/java/jersey3-jackson3/build.gradle index cbaad2e513fc..9f61251d48a0 100644 --- a/samples/client/petstore/java/jersey3-jackson3/build.gradle +++ b/samples/client/petstore/java/jersey3-jackson3/build.gradle @@ -20,6 +20,20 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.5" + jackson3_version = "3.1.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jersey_version = "3.0.4" + junit_version = "5.8.2" + scribejava_apis_version = "8.3.1" + tomitribe_http_signatures_version = "1.7" + commons_lang3_version = "3.17.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,20 +113,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.5" - jackson3_version = "3.1.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jersey_version = "3.0.4" - junit_version = "5.8.2" - scribejava_apis_version = "8.3.1" - tomitribe_http_signatures_version = "1.7" - commons_lang3_version = "3.17.0" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/jersey3-oneOf/build.gradle b/samples/client/petstore/java/jersey3-oneOf/build.gradle index 157fb07be735..bc335aa41ee7 100644 --- a/samples/client/petstore/java/jersey3-oneOf/build.gradle +++ b/samples/client/petstore/java/jersey3-oneOf/build.gradle @@ -20,6 +20,17 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.5" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "3.0.0" + jersey_version = "3.0.4" + junit_version = "5.8.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,17 +110,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.5" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "3.0.0" - jersey_version = "3.0.4" - junit_version = "5.8.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/jersey3/build.gradle b/samples/client/petstore/java/jersey3/build.gradle index f7d3560b28d1..e70babca5a5a 100644 --- a/samples/client/petstore/java/jersey3/build.gradle +++ b/samples/client/petstore/java/jersey3/build.gradle @@ -20,6 +20,21 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.5" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jersey_version = "3.0.4" + junit_version = "5.8.2" + scribejava_apis_version = "8.3.1" + tomitribe_http_signatures_version = "1.7" + commons_lang3_version = "3.17.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,21 +114,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.5" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jersey_version = "3.0.4" - junit_version = "5.8.2" - scribejava_apis_version = "8.3.1" - tomitribe_http_signatures_version = "1.7" - commons_lang3_version = "3.17.0" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/build.gradle b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/build.gradle index 8b73b0ca05f1..db5a5ce70667 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/petstore/java/okhttp-gson-3.1/build.gradle b/samples/client/petstore/java/okhttp-gson-3.1/build.gradle index aa8462688f20..3f21d8bda53c 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-3.1/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/petstore/java/okhttp-gson-awsv4signature/build.gradle b/samples/client/petstore/java/okhttp-gson-awsv4signature/build.gradle index 4667113f4626..0891c71fc489 100644 --- a/samples/client/petstore/java/okhttp-gson-awsv4signature/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-awsv4signature/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/build.gradle b/samples/client/petstore/java/okhttp-gson-dynamicOperations/build.gradle index 5d1dafc364a4..41bcd29ca4b4 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/build.gradle b/samples/client/petstore/java/okhttp-gson-group-parameter/build.gradle index f3e422ba24c8..7404409ee8ca 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/petstore/java/okhttp-gson-nullable-required/build.gradle b/samples/client/petstore/java/okhttp-gson-nullable-required/build.gradle index 21c5c88ef179..7309dc62ce78 100644 --- a/samples/client/petstore/java/okhttp-gson-nullable-required/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-nullable-required/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle index 4b5115be1eef..b31b1d3ec5bf 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/petstore/java/okhttp-gson-swagger1/build.gradle b/samples/client/petstore/java/okhttp-gson-swagger1/build.gradle index 2731aa94f918..8821304c3922 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger1/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-swagger1/build.gradle @@ -24,6 +24,11 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + swagger_annotations_version = "1.6.9" + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,11 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.9" - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/okhttp-gson-swagger2/build.gradle b/samples/client/petstore/java/okhttp-gson-swagger2/build.gradle index 296370127e67..6a6a606f70c8 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger2/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-swagger2/build.gradle @@ -24,6 +24,11 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + swagger_annotations_version = "2.2.9" + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,11 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "2.2.9" - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/okhttp-gson/build.gradle b/samples/client/petstore/java/okhttp-gson/build.gradle index cfeeabda27eb..5f9a0a55a7e7 100644 --- a/samples/client/petstore/java/okhttp-gson/build.gradle +++ b/samples/client/petstore/java/okhttp-gson/build.gradle @@ -24,6 +24,10 @@ sourceSets { main.java.srcDirs = ['src/main/java'] } +ext { + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,10 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' diff --git a/samples/client/petstore/java/rest-assured-jackson/build.gradle b/samples/client/petstore/java/rest-assured-jackson/build.gradle index 2b288afae5a1..3395c4fdc052 100644 --- a/samples/client/petstore/java/rest-assured-jackson/build.gradle +++ b/samples/client/petstore/java/rest-assured-jackson/build.gradle @@ -19,6 +19,16 @@ repositories { } +ext { + rest_assured_version = "5.5.6" + junit_version = "5.10.3" + jackson_version = "2.21.5" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + okio_version = "3.6.0" + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,16 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - rest_assured_version = "5.5.6" - junit_version = "5.10.3" - jackson_version = "2.21.5" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - okio_version = "3.6.0" - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.rest-assured:rest-assured:$rest_assured_version" diff --git a/samples/client/petstore/java/rest-assured/build.gradle b/samples/client/petstore/java/rest-assured/build.gradle index 81406852c5cb..55bf8f059d05 100644 --- a/samples/client/petstore/java/rest-assured/build.gradle +++ b/samples/client/petstore/java/rest-assured/build.gradle @@ -19,6 +19,15 @@ repositories { } +ext { + rest_assured_version = "5.5.6" + junit_version = "5.10.3" + gson_version = "2.10.1" + gson_fire_version = "1.9.0" + okio_version = "3.6.0" + jakarta_annotation_version = "1.3.5" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,15 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - rest_assured_version = "5.5.6" - junit_version = "5.10.3" - gson_version = "2.10.1" - gson_fire_version = "1.9.0" - okio_version = "3.6.0" - jakarta_annotation_version = "1.3.5" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.rest-assured:rest-assured:$rest_assured_version" diff --git a/samples/client/petstore/java/restclient-nullable-arrays/build.gradle b/samples/client/petstore/java/restclient-nullable-arrays/build.gradle index 3b15d3fa8640..a1694cd0159d 100644 --- a/samples/client/petstore/java/restclient-nullable-arrays/build.gradle +++ b/samples/client/petstore/java/restclient-nullable-arrays/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson2/build.gradle b/samples/client/petstore/java/restclient-springBoot4-jackson2/build.gradle index c6a35eb685aa..1917c5dcc6c8 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson2/build.gradle +++ b/samples/client/petstore/java/restclient-springBoot4-jackson2/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/build.gradle b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/build.gradle index beb0694274d5..92d8df2735ef 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/build.gradle +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "3.1.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "3.1.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/build.gradle b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/build.gradle index e49e0bb15ad6..1a1f5be18593 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/build.gradle +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/build.gradle @@ -19,6 +19,16 @@ repositories { } +ext { + jackson_version = "3.1.5" + jackson_annotations_version = "2.21" + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,16 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "3.1.5" - jackson_annotations_version = "2.21" - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3/build.gradle b/samples/client/petstore/java/restclient-springBoot4-jackson3/build.gradle index e49e0bb15ad6..1a1f5be18593 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3/build.gradle +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3/build.gradle @@ -19,6 +19,16 @@ repositories { } +ext { + jackson_version = "3.1.5" + jackson_annotations_version = "2.21" + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,16 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "3.1.5" - jackson_annotations_version = "2.21" - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/restclient-swagger2/build.gradle b/samples/client/petstore/java/restclient-swagger2/build.gradle index 151336395ae0..b3773f66f10e 100644 --- a/samples/client/petstore/java/restclient-swagger2/build.gradle +++ b/samples/client/petstore/java/restclient-swagger2/build.gradle @@ -19,6 +19,18 @@ repositories { } +ext { + swagger_annotations_version = "2.2.43" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,18 +110,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "2.2.43" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/build.gradle b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/build.gradle index 37051a94a1a1..53745c2f4a91 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/build.gradle +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/build.gradle b/samples/client/petstore/java/restclient-useSingleRequestParameter/build.gradle index ff181739d598..9246c0038bae 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/build.gradle +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/restclient/build.gradle b/samples/client/petstore/java/restclient/build.gradle index cbe35507537b..e1e9a89fe6c6 100644 --- a/samples/client/petstore/java/restclient/build.gradle +++ b/samples/client/petstore/java/restclient/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.16" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.1.1" + jodatime_version = "2.14.0" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.16" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.1.1" - jodatime_version = "2.14.0" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/resteasy/build.gradle b/samples/client/petstore/java/resteasy/build.gradle index 68b1c4432149..12c2b80b9fcc 100644 --- a/samples/client/petstore/java/resteasy/build.gradle +++ b/samples/client/petstore/java/resteasy/build.gradle @@ -19,6 +19,18 @@ repositories { } +ext { + swagger_annotations_version = "1.6.3" + jackson_version = "2.21.5" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + threetenbp_version = "2.9.10" + resteasy_version = "4.5.11.Final" + assertj_version = "3.23.1" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,18 +110,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.3" - jackson_version = "2.21.5" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - threetenbp_version = "2.9.10" - resteasy_version = "4.5.11.Final" - assertj_version = "3.23.1" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/resttemplate-jakarta/build.gradle b/samples/client/petstore/java/resttemplate-jakarta/build.gradle index 081af58759f3..3168163d0d2c 100644 --- a/samples/client/petstore/java/resttemplate-jakarta/build.gradle +++ b/samples/client/petstore/java/resttemplate-jakarta/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "6.2.8" + jakarta_annotation_version = "2.1.1" + bean_validation_version = "3.0.2" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "6.2.8" - jakarta_annotation_version = "2.1.1" - bean_validation_version = "3.0.2" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson2/build.gradle b/samples/client/petstore/java/resttemplate-springBoot4-jackson2/build.gradle index 954545a028bf..dde8b0376dc3 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson2/build.gradle +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson2/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/build.gradle b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/build.gradle index 586ccfd61131..0b4d720b5f15 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/build.gradle +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/build.gradle @@ -19,6 +19,16 @@ repositories { } +ext { + jackson_version = "3.1.5" + jackson_annotations_version = "2.21" + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,16 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "3.1.5" - jackson_annotations_version = "2.21" - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3/build.gradle b/samples/client/petstore/java/resttemplate-springBoot4-jackson3/build.gradle index 63c2a626785b..657b810a5322 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3/build.gradle +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3/build.gradle @@ -19,6 +19,16 @@ repositories { } +ext { + jackson_version = "3.1.5" + jackson_annotations_version = "2.21" + spring_web_version = "7.0.8" + jakarta_annotation_version = "3.0.0" + bean_validation_version = "3.1.1" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,16 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "3.1.5" - jackson_annotations_version = "2.21" - spring_web_version = "7.0.8" - jakarta_annotation_version = "3.0.0" - bean_validation_version = "3.1.1" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/petstore/java/resttemplate-swagger1/build.gradle b/samples/client/petstore/java/resttemplate-swagger1/build.gradle index 7337ea12739a..109da973d13b 100644 --- a/samples/client/petstore/java/resttemplate-swagger1/build.gradle +++ b/samples/client/petstore/java/resttemplate-swagger1/build.gradle @@ -19,6 +19,18 @@ repositories { } +ext { + swagger_annotations_version = "1.6.9" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "5.3.33" + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,18 +110,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.9" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "5.3.33" - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/resttemplate-swagger2/build.gradle b/samples/client/petstore/java/resttemplate-swagger2/build.gradle index c9f291c39022..f4b665b88c5e 100644 --- a/samples/client/petstore/java/resttemplate-swagger2/build.gradle +++ b/samples/client/petstore/java/resttemplate-swagger2/build.gradle @@ -19,6 +19,18 @@ repositories { } +ext { + swagger_annotations_version = "2.2.9" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "5.3.33" + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,18 +110,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "2.2.9" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "5.3.33" - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/resttemplate-withXml/build.gradle b/samples/client/petstore/java/resttemplate-withXml/build.gradle index 8a018bddcba3..705bc393c4d5 100644 --- a/samples/client/petstore/java/resttemplate-withXml/build.gradle +++ b/samples/client/petstore/java/resttemplate-withXml/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "5.3.33" + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "5.3.33" - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/petstore/java/resttemplate/build.gradle b/samples/client/petstore/java/resttemplate/build.gradle index 47fc1c4a46e9..1a957ff3158e 100644 --- a/samples/client/petstore/java/resttemplate/build.gradle +++ b/samples/client/petstore/java/resttemplate/build.gradle @@ -19,6 +19,17 @@ repositories { } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + spring_web_version = "5.3.33" + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,17 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - spring_web_version = "5.3.33" - jakarta_annotation_version = "1.3.5" - bean_validation_version = "2.0.2" - jodatime_version = "2.9.9" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" diff --git a/samples/client/petstore/java/retrofit2-play26/build.gradle b/samples/client/petstore/java/retrofit2-play26/build.gradle index b058b6524335..3ac27c611e8b 100644 --- a/samples/client/petstore/java/retrofit2-play26/build.gradle +++ b/samples/client/petstore/java/retrofit2-play26/build.gradle @@ -19,6 +19,21 @@ repositories { } +ext { + oltu_version = "1.0.1" + retrofit_version = "2.11.0" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + javax_ws_rs_api_version = "2.1.1" + jackson_databind_nullable_version = "0.2.11" + play_version = "2.6.7" + jakarta_annotation_version = "1.3.5" + swagger_annotations_version = "1.5.22" + junit_version = "5.10.3" + json_fire_version = "1.9.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,21 +113,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - oltu_version = "1.0.1" - retrofit_version = "2.11.0" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - javax_ws_rs_api_version = "2.1.1" - jackson_databind_nullable_version = "0.2.11" - play_version = "2.6.7" - jakarta_annotation_version = "1.3.5" - swagger_annotations_version = "1.5.22" - junit_version = "5.10.3" - json_fire_version = "1.9.0" -} - dependencies { implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version" diff --git a/samples/client/petstore/java/retrofit2/build.gradle b/samples/client/petstore/java/retrofit2/build.gradle index f55348d5a410..75b530b686fc 100644 --- a/samples/client/petstore/java/retrofit2/build.gradle +++ b/samples/client/petstore/java/retrofit2/build.gradle @@ -19,6 +19,15 @@ repositories { } +ext { + oltu_version = "1.0.1" + retrofit_version = "2.11.0" + jakarta_annotation_version = "1.3.5" + swagger_annotations_version = "1.5.22" + junit_version = "5.10.3" + json_fire_version = "1.9.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,15 +107,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - oltu_version = "1.0.1" - retrofit_version = "2.11.0" - jakarta_annotation_version = "1.3.5" - swagger_annotations_version = "1.5.22" - junit_version = "5.10.3" - json_fire_version = "1.9.0" -} - dependencies { implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version" diff --git a/samples/client/petstore/java/retrofit2rx2/build.gradle b/samples/client/petstore/java/retrofit2rx2/build.gradle index e179d9796a55..055fae128708 100644 --- a/samples/client/petstore/java/retrofit2rx2/build.gradle +++ b/samples/client/petstore/java/retrofit2rx2/build.gradle @@ -19,6 +19,16 @@ repositories { } +ext { + oltu_version = "1.0.1" + retrofit_version = "2.11.0" + jakarta_annotation_version = "1.3.5" + swagger_annotations_version = "1.5.22" + junit_version = "5.10.3" + rx_java_version = "2.1.1" + json_fire_version = "1.9.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,16 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - oltu_version = "1.0.1" - retrofit_version = "2.11.0" - jakarta_annotation_version = "1.3.5" - swagger_annotations_version = "1.5.22" - junit_version = "5.10.3" - rx_java_version = "2.1.1" - json_fire_version = "1.9.0" -} - dependencies { implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version" diff --git a/samples/client/petstore/java/retrofit2rx3/build.gradle b/samples/client/petstore/java/retrofit2rx3/build.gradle index c0ea8db2d67f..0ab449805a68 100644 --- a/samples/client/petstore/java/retrofit2rx3/build.gradle +++ b/samples/client/petstore/java/retrofit2rx3/build.gradle @@ -19,6 +19,16 @@ repositories { } +ext { + oltu_version = "1.0.1" + retrofit_version = "2.11.0" + jakarta_annotation_version = "1.3.5" + swagger_annotations_version = "1.5.22" + junit_version = "5.10.3" + rx_java_version = "3.0.4" + json_fire_version = "1.9.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -98,16 +108,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - oltu_version = "1.0.1" - retrofit_version = "2.11.0" - jakarta_annotation_version = "1.3.5" - swagger_annotations_version = "1.5.22" - junit_version = "5.10.3" - rx_java_version = "3.0.4" - json_fire_version = "1.9.0" -} - dependencies { implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version" diff --git a/samples/client/petstore/java/webclient-jakarta/build.gradle b/samples/client/petstore/java/webclient-jakarta/build.gradle index 68248f38f288..740c04ea1ffe 100644 --- a/samples/client/petstore/java/webclient-jakarta/build.gradle +++ b/samples/client/petstore/java/webclient-jakarta/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "3.5.11" + jakarta_annotation_version = "3.0.0" + beanvalidation_version = "3.0.2" + reactor_version = "3.5.12" + reactor_netty_version = "1.2.8" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,18 +125,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "3.5.11" - jakarta_annotation_version = "3.0.0" - beanvalidation_version = "3.0.2" - reactor_version = "3.5.12" - reactor_netty_version = "1.2.8" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" diff --git a/samples/client/petstore/java/webclient-nullable-arrays/build.gradle b/samples/client/petstore/java/webclient-nullable-arrays/build.gradle index c35d05237cf1..fb4316e79147 100644 --- a/samples/client/petstore/java/webclient-nullable-arrays/build.gradle +++ b/samples/client/petstore/java/webclient-nullable-arrays/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + reactor_version = "3.4.34" + reactor_netty_version = "1.2.8" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,18 +125,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "2.7.17" - jakarta_annotation_version = "1.3.5" - beanvalidation_version = "2.0.2" - reactor_version = "3.4.34" - reactor_netty_version = "1.2.8" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/build.gradle b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/build.gradle index d3227bef96ce..627ee85ba2a7 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/build.gradle +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/build.gradle @@ -18,6 +18,17 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "4.0.3" + jakarta_annotation_version = "3.0.0" + beanvalidation_version = "3.0.2" + reactor_version = "3.5.12" + reactor_netty_version = "1.2.8" + jackson_version = "3.1.5" + jackson_annotations_version = "2.21" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,17 +124,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "4.0.3" - jakarta_annotation_version = "3.0.0" - beanvalidation_version = "3.0.2" - reactor_version = "3.5.12" - reactor_netty_version = "1.2.8" - jackson_version = "3.1.5" - jackson_annotations_version = "2.21" - junit_version = "5.10.2" -} - dependencies { implementation "io.projectreactor:reactor-core:$reactor_version" implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version" diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3/build.gradle b/samples/client/petstore/java/webclient-springBoot4-jackson3/build.gradle index fbbf9bdba1f8..f5da3b872c0f 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3/build.gradle +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3/build.gradle @@ -18,6 +18,17 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "4.0.3" + jakarta_annotation_version = "3.0.0" + beanvalidation_version = "3.0.2" + reactor_version = "3.5.12" + reactor_netty_version = "1.2.8" + jackson_version = "3.1.5" + jackson_annotations_version = "2.21" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,17 +124,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "4.0.3" - jakarta_annotation_version = "3.0.0" - beanvalidation_version = "3.0.2" - reactor_version = "3.5.12" - reactor_netty_version = "1.2.8" - jackson_version = "3.1.5" - jackson_annotations_version = "2.21" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" diff --git a/samples/client/petstore/java/webclient-swagger2/build.gradle b/samples/client/petstore/java/webclient-swagger2/build.gradle index 73a7da04b304..c5743b89ad75 100644 --- a/samples/client/petstore/java/webclient-swagger2/build.gradle +++ b/samples/client/petstore/java/webclient-swagger2/build.gradle @@ -18,6 +18,19 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "2.2.43" + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + reactor_version = "3.4.34" + reactor_netty_version = "1.2.8" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,19 +126,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "2.2.43" - spring_boot_version = "2.7.17" - jakarta_annotation_version = "1.3.5" - beanvalidation_version = "2.0.2" - reactor_version = "3.4.34" - reactor_netty_version = "1.2.8" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - junit_version = "5.10.2" -} - dependencies { implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/build.gradle b/samples/client/petstore/java/webclient-useSingleRequestParameter/build.gradle index 3f52d19c2250..9f1b59425bb8 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/build.gradle +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + reactor_version = "3.4.34" + reactor_netty_version = "1.2.8" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,18 +125,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "2.7.17" - jakarta_annotation_version = "1.3.5" - beanvalidation_version = "2.0.2" - reactor_version = "3.4.34" - reactor_netty_version = "1.2.8" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" diff --git a/samples/client/petstore/java/webclient/build.gradle b/samples/client/petstore/java/webclient/build.gradle index fbe1f81d563c..46a436d63285 100644 --- a/samples/client/petstore/java/webclient/build.gradle +++ b/samples/client/petstore/java/webclient/build.gradle @@ -18,6 +18,18 @@ repositories { mavenCentral() } +ext { + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + beanvalidation_version = "2.0.2" + reactor_version = "3.4.34" + reactor_netty_version = "1.2.8" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_nullable_version = "0.2.11" + junit_version = "5.10.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -113,18 +125,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - spring_boot_version = "2.7.17" - jakarta_annotation_version = "1.3.5" - beanvalidation_version = "2.0.2" - reactor_version = "3.4.34" - reactor_netty_version = "1.2.8" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_nullable_version = "0.2.11" - junit_version = "5.10.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle index 582d7c102d72..72c63a3e77a2 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle @@ -20,6 +20,16 @@ repositories { mavenCentral() } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,16 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle index 6f6d46a17694..58b6cc0cd000 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle @@ -20,6 +20,16 @@ repositories { mavenCentral() } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,16 +109,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/build.gradle index acdaf782b4b0..ee36234a7c07 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/build.gradle @@ -20,6 +20,18 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "1.6.6" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" + scribejava_apis_version = "8.3.1" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,18 +111,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "1.6.6" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" - scribejava_apis_version = "8.3.1" -} - dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/build.gradle index a05297fe7220..68e3efbf6c64 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/build.gradle @@ -20,6 +20,18 @@ repositories { mavenCentral() } +ext { + swagger_annotations_version = "2.2.15" + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" + scribejava_apis_version = "8.3.1" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,18 +111,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - swagger_annotations_version = "2.2.15" - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" - scribejava_apis_version = "8.3.1" -} - dependencies { implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle index d9bde2ec01da..2141b3914f97 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle @@ -20,6 +20,19 @@ repositories { mavenCentral() } +ext { + jackson_version = "2.21.5" + jackson_annotations_version = "2.21" + jackson_databind_version = "2.21.5" + jackson_databind_nullable_version = "0.2.11" + jakarta_annotation_version = "1.3.5" + jersey_version = "2.35" + junit_version = "5.8.2" + scribejava_apis_version = "8.3.1" + tomitribe_http_signatures_version = "1.7" + commons_lang3_version = "3.17.0" +} + if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -99,19 +112,6 @@ if(hasProperty('target') && target == 'android') { } } -ext { - jackson_version = "2.21.5" - jackson_annotations_version = "2.21" - jackson_databind_version = "2.21.5" - jackson_databind_nullable_version = "0.2.11" - jakarta_annotation_version = "1.3.5" - jersey_version = "2.35" - junit_version = "5.8.2" - scribejava_apis_version = "8.3.1" - tomitribe_http_signatures_version = "1.7" - commons_lang3_version = "3.17.0" -} - dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator-ignore b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator/FILES b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator/FILES new file mode 100644 index 000000000000..e84510ea86bf --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator/FILES @@ -0,0 +1,22 @@ +README.md +pom.xml +src/main/java/org/openapitools/OpenApiGeneratorApplication.java +src/main/java/org/openapitools/RFC3339DateFormat.java +src/main/java/org/openapitools/api/AnimalsApi.java +src/main/java/org/openapitools/api/ApiUtil.java +src/main/java/org/openapitools/api/BeveragesApi.java +src/main/java/org/openapitools/api/FruitsApi.java +src/main/java/org/openapitools/configuration/HomeController.java +src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +src/main/java/org/openapitools/model/Animal.java +src/main/java/org/openapitools/model/Apple.java +src/main/java/org/openapitools/model/Banana.java +src/main/java/org/openapitools/model/Beverage.java +src/main/java/org/openapitools/model/Cat.java +src/main/java/org/openapitools/model/Dog.java +src/main/java/org/openapitools/model/Fruit.java +src/main/java/org/openapitools/model/Soda.java +src/main/java/org/openapitools/model/Water.java +src/main/resources/application.properties +src/main/resources/openapi.yaml +src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator/VERSION b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator/VERSION new file mode 100644 index 000000000000..8fc8df61083a --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.25.0-SNAPSHOT diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/README.md b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/README.md new file mode 100644 index 000000000000..221eb1b8e97d --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/README.md @@ -0,0 +1,21 @@ +# OpenAPI generated server + +Spring Boot Server + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building an OpenAPI-enabled server in Java using the SpringBoot framework. + + +The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org). +Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes. +The specification is available to download using the following url: +http://localhost:8080/v3/api-docs/ + +Start your server as a simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/swagger-ui.html + +Change default port value in application.properties \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/pom.xml b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/pom.xml new file mode 100644 index 000000000000..3a2991afc2c7 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/pom.xml @@ -0,0 +1,78 @@ + + 4.0.0 + org.openapitools.openapi3 + springboot-oneof-jackson-default-impl + jar + springboot-oneof-jackson-default-impl + 0.0.1-SNAPSHOT + + 17 + ${java.version} + UTF-8 + 2.6.0 + 5.17.14 + + + org.springframework.boot + spring-boot-starter-parent + 3.3.13 + + + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.data + spring-data-commons + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + ${springdoc.version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.openapitools + jackson-databind-nullable + 0.2.11 + + + + org.springframework.boot + spring-boot-starter-validation + + + com.fasterxml.jackson.core + jackson-databind + + + org.springframework.boot + spring-boot-starter-test + test + + + diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/OpenApiGeneratorApplication.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/OpenApiGeneratorApplication.java new file mode 100644 index 000000000000..97252a8a9402 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/OpenApiGeneratorApplication.java @@ -0,0 +1,30 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.Module; +import org.openapitools.jackson.nullable.JsonNullableModule; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator; + +@SpringBootApplication( + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +@ComponentScan( + basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}, + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +public class OpenApiGeneratorApplication { + + public static void main(String[] args) { + SpringApplication.run(OpenApiGeneratorApplication.class, args); + } + + @Bean(name = "org.openapitools.OpenApiGeneratorApplication.jsonNullableModule") + public Module jsonNullableModule() { + return new JsonNullableModule(); + } + +} \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/RFC3339DateFormat.java new file mode 100644 index 000000000000..bcd3936d8b34 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -0,0 +1,38 @@ +package org.openapitools; + +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, 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; + } +} \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApi.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApi.java new file mode 100644 index 000000000000..3d60218875a0 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApi.java @@ -0,0 +1,83 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.Animal; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@Validated +@Tag(name = "animals", description = "the animals API") +public interface AnimalsApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_CREATE_ANIMAL = "/animals"; + /** + * POST /animals + * + * @param animal (required) + * @return OK (status code 200) + */ + @Operation( + operationId = "createAnimal", + tags = { "default" }, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Animal.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = AnimalsApi.PATH_CREATE_ANIMAL, + produces = { "application/json" }, + consumes = { "application/json" } + ) + default ResponseEntity createAnimal( + @Parameter(name = "Animal", description = "", required = true) @Valid @RequestBody Animal animal + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"bark\" : true }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiController.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiController.java new file mode 100644 index 000000000000..0396d402f61b --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.openapitools.model.Animal; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.jacksonDefaultImplOneOfSample.base-path:}") +public class AnimalsApiController implements AnimalsApi { + + private final NativeWebRequest request; + + @Autowired + public AnimalsApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/ApiUtil.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/ApiUtil.java new file mode 100644 index 000000000000..44bf770ccc47 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/ApiUtil.java @@ -0,0 +1,21 @@ +package org.openapitools.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + if (res != null) { + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApi.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApi.java new file mode 100644 index 000000000000..8f4ad1808a59 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApi.java @@ -0,0 +1,83 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.Beverage; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@Validated +@Tag(name = "beverages", description = "the beverages API") +public interface BeveragesApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_CREATE_BEVERAGE = "/beverages"; + /** + * POST /beverages + * + * @param beverage (required) + * @return OK (status code 200) + */ + @Operation( + operationId = "createBeverage", + tags = { "default" }, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Beverage.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = BeveragesApi.PATH_CREATE_BEVERAGE, + produces = { "application/json" }, + consumes = { "application/json" } + ) + default ResponseEntity createBeverage( + @Parameter(name = "Beverage", description = "", required = true) @Valid @RequestBody Beverage beverage + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"beverageType\" : \"beverageType\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiController.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiController.java new file mode 100644 index 000000000000..1133f307b361 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.openapitools.model.Beverage; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.jacksonDefaultImplOneOfSample.base-path:}") +public class BeveragesApiController implements BeveragesApi { + + private final NativeWebRequest request; + + @Autowired + public BeveragesApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApi.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApi.java new file mode 100644 index 000000000000..13ce39785b11 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApi.java @@ -0,0 +1,83 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.Fruit; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@Validated +@Tag(name = "fruits", description = "the fruits API") +public interface FruitsApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_CREATE_FRUIT = "/fruits"; + /** + * POST /fruits + * + * @param fruit (required) + * @return OK (status code 200) + */ + @Operation( + operationId = "createFruit", + tags = { "default" }, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Fruit.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = FruitsApi.PATH_CREATE_FRUIT, + produces = { "application/json" }, + consumes = { "application/json" } + ) + default ResponseEntity createFruit( + @Parameter(name = "Fruit", description = "", required = true) @Valid @RequestBody Fruit fruit + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"fruitType\" : \"fruitType\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiController.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiController.java new file mode 100644 index 000000000000..427f3d767719 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.openapitools.model.Fruit; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.jacksonDefaultImplOneOfSample.base-path:}") +public class FruitsApiController implements FruitsApi { + + private final NativeWebRequest request; + + @Autowired + public FruitsApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/configuration/HomeController.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/configuration/HomeController.java new file mode 100644 index 000000000000..9aa29284ab5f --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/configuration/HomeController.java @@ -0,0 +1,20 @@ +package org.openapitools.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + + @RequestMapping("/") + public String index() { + return "redirect:swagger-ui.html"; + } + +} \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java new file mode 100644 index 000000000000..3372a3bae8fe --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -0,0 +1,27 @@ +package org.openapitools.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.security.SecurityScheme; + +@Configuration +public class SpringDocConfiguration { + + @Bean(name = "org.openapitools.configuration.SpringDocConfiguration.apiInfo") + OpenAPI apiInfo() { + return new OpenAPI() + .info( + new Info() + .title("Jackson defaultImpl oneOf sample") + .description("Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). ") + .version("0.0.1") + ) + ; + } +} \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Animal.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Animal.java new file mode 100644 index 000000000000..553babbdf18f --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Animal.java @@ -0,0 +1,32 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openapitools.model.Cat; +import org.openapitools.model.Dog; +import org.springframework.lang.Nullable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + + + +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class), + @JsonSubTypes.Type(value = Cat.class) +}) +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public interface Animal { +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Apple.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Apple.java new file mode 100644 index 000000000000..b76a00ffb994 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Apple.java @@ -0,0 +1,124 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Apple + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Apple implements Fruit { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String fruitType; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private @Nullable Integer seeds; + + public Apple() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Apple(String fruitType) { + this.fruitType = fruitType; + } + + public Apple fruitType(String fruitType) { + this.fruitType = fruitType; + return this; + } + + /** + * Get fruitType + * @return fruitType + */ + @NotNull + @Schema(name = "fruitType", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("fruitType") + public String getFruitType() { + return fruitType; + } + + @JsonProperty("fruitType") + public void setFruitType(String fruitType) { + this.fruitType = fruitType; + } + + public Apple seeds(@Nullable Integer seeds) { + this.seeds = seeds; + return this; + } + + /** + * Get seeds + * @return seeds + */ + + @Schema(name = "seeds", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("seeds") + public @Nullable Integer getSeeds() { + return seeds; + } + + @JsonProperty("seeds") + public void setSeeds(@Nullable Integer seeds) { + this.seeds = seeds; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Apple apple = (Apple) o; + return Objects.equals(this.fruitType, apple.fruitType) && + Objects.equals(this.seeds, apple.seeds); + } + + @Override + public int hashCode() { + return Objects.hash(fruitType, seeds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Apple {\n"); + sb.append(" fruitType: ").append(toIndentedString(fruitType)).append("\n"); + sb.append(" seeds: ").append(toIndentedString(seeds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Banana.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Banana.java new file mode 100644 index 000000000000..5f7250f7e01d --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Banana.java @@ -0,0 +1,124 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Banana + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Banana implements Fruit { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String fruitType; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private @Nullable Integer length; + + public Banana() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Banana(String fruitType) { + this.fruitType = fruitType; + } + + public Banana fruitType(String fruitType) { + this.fruitType = fruitType; + return this; + } + + /** + * Get fruitType + * @return fruitType + */ + @NotNull + @Schema(name = "fruitType", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("fruitType") + public String getFruitType() { + return fruitType; + } + + @JsonProperty("fruitType") + public void setFruitType(String fruitType) { + this.fruitType = fruitType; + } + + public Banana length(@Nullable Integer length) { + this.length = length; + return this; + } + + /** + * Get length + * @return length + */ + + @Schema(name = "length", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("length") + public @Nullable Integer getLength() { + return length; + } + + @JsonProperty("length") + public void setLength(@Nullable Integer length) { + this.length = length; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Banana banana = (Banana) o; + return Objects.equals(this.fruitType, banana.fruitType) && + Objects.equals(this.length, banana.length); + } + + @Override + public int hashCode() { + return Objects.hash(fruitType, length); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banana {\n"); + sb.append(" fruitType: ").append(toIndentedString(fruitType)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Beverage.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Beverage.java new file mode 100644 index 000000000000..b2b3468a06a0 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Beverage.java @@ -0,0 +1,38 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.Soda; +import org.openapitools.model.Water; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + + +@JsonIgnoreProperties( + value = "beverageType", // ignore manually set beverageType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the beverageType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "beverageType", visible = true, defaultImpl = Water.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Soda.class, name = "SODA"), + @JsonSubTypes.Type(value = Water.class, name = "WATER") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public interface Beverage { + public String getBeverageType(); +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Cat.java new file mode 100644 index 000000000000..9c8ba78f46c0 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Cat.java @@ -0,0 +1,84 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Cat + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Cat implements Animal { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private @Nullable Boolean declawed; + + public Cat declawed(@Nullable Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + + @Schema(name = "declawed", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("declawed") + public @Nullable Boolean getDeclawed() { + return declawed; + } + + @JsonProperty("declawed") + public void setDeclawed(@Nullable Boolean declawed) { + this.declawed = declawed; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Dog.java new file mode 100644 index 000000000000..6474eab33c57 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Dog.java @@ -0,0 +1,84 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Dog + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Dog implements Animal { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private @Nullable Boolean bark; + + public Dog bark(@Nullable Boolean bark) { + this.bark = bark; + return this; + } + + /** + * Get bark + * @return bark + */ + + @Schema(name = "bark", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("bark") + public @Nullable Boolean getBark() { + return bark; + } + + @JsonProperty("bark") + public void setBark(@Nullable Boolean bark) { + this.bark = bark; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.bark, dog.bark); + } + + @Override + public int hashCode() { + return Objects.hash(bark); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" bark: ").append(toIndentedString(bark)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Fruit.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Fruit.java new file mode 100644 index 000000000000..0efb0956e4b2 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Fruit.java @@ -0,0 +1,38 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.Apple; +import org.openapitools.model.Banana; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + + +@JsonIgnoreProperties( + value = "fruitType", // ignore manually set fruitType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the fruitType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fruitType", visible = true, defaultImpl = Apple.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Apple.class, name = "APPLE"), + @JsonSubTypes.Type(value = Banana.class, name = "BANANA") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public interface Fruit { + public String getFruitType(); +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Soda.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Soda.java new file mode 100644 index 000000000000..2f0f4b4e8184 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Soda.java @@ -0,0 +1,124 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Soda + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Soda implements Beverage { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String beverageType; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private @Nullable Integer sugarGrams; + + public Soda() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Soda(String beverageType) { + this.beverageType = beverageType; + } + + public Soda beverageType(String beverageType) { + this.beverageType = beverageType; + return this; + } + + /** + * Get beverageType + * @return beverageType + */ + @NotNull + @Schema(name = "beverageType", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("beverageType") + public String getBeverageType() { + return beverageType; + } + + @JsonProperty("beverageType") + public void setBeverageType(String beverageType) { + this.beverageType = beverageType; + } + + public Soda sugarGrams(@Nullable Integer sugarGrams) { + this.sugarGrams = sugarGrams; + return this; + } + + /** + * Get sugarGrams + * @return sugarGrams + */ + + @Schema(name = "sugarGrams", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("sugarGrams") + public @Nullable Integer getSugarGrams() { + return sugarGrams; + } + + @JsonProperty("sugarGrams") + public void setSugarGrams(@Nullable Integer sugarGrams) { + this.sugarGrams = sugarGrams; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Soda soda = (Soda) o; + return Objects.equals(this.beverageType, soda.beverageType) && + Objects.equals(this.sugarGrams, soda.sugarGrams); + } + + @Override + public int hashCode() { + return Objects.hash(beverageType, sugarGrams); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" beverageType: ").append(toIndentedString(beverageType)).append("\n"); + sb.append(" sugarGrams: ").append(toIndentedString(sugarGrams)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Water.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Water.java new file mode 100644 index 000000000000..e55142234313 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Water.java @@ -0,0 +1,124 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Water + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Water implements Beverage { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String beverageType; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private @Nullable Boolean sparkling; + + public Water() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Water(String beverageType) { + this.beverageType = beverageType; + } + + public Water beverageType(String beverageType) { + this.beverageType = beverageType; + return this; + } + + /** + * Get beverageType + * @return beverageType + */ + @NotNull + @Schema(name = "beverageType", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("beverageType") + public String getBeverageType() { + return beverageType; + } + + @JsonProperty("beverageType") + public void setBeverageType(String beverageType) { + this.beverageType = beverageType; + } + + public Water sparkling(@Nullable Boolean sparkling) { + this.sparkling = sparkling; + return this; + } + + /** + * Get sparkling + * @return sparkling + */ + + @Schema(name = "sparkling", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("sparkling") + public @Nullable Boolean getSparkling() { + return sparkling; + } + + @JsonProperty("sparkling") + public void setSparkling(@Nullable Boolean sparkling) { + this.sparkling = sparkling; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Water water = (Water) o; + return Objects.equals(this.beverageType, water.beverageType) && + Objects.equals(this.sparkling, water.sparkling); + } + + @Override + public int hashCode() { + return Objects.hash(beverageType, sparkling); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Water {\n"); + sb.append(" beverageType: ").append(toIndentedString(beverageType)).append("\n"); + sb.append(" sparkling: ").append(toIndentedString(sparkling)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/resources/application.properties b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/resources/application.properties new file mode 100644 index 000000000000..7e90813e59b2 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8080 +spring.jackson.date-format=org.openapitools.RFC3339DateFormat +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/resources/openapi.yaml b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/resources/openapi.yaml new file mode 100644 index 000000000000..f6a72dac7da3 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/main/resources/openapi.yaml @@ -0,0 +1,171 @@ +openapi: 3.0.1 +info: + description: | + Sample spec exercising Jackson @JsonTypeInfo(defaultImpl = ...) on oneOf interfaces, driven by the x-jackson-default-impl vendor extension (spec-based) and the typeInfoDefaultImpls generator option (config-based). + title: Jackson defaultImpl oneOf sample + version: 0.0.1 +servers: +- url: http://localhost:8080 +paths: + /animals: + post: + operationId: createAnimal + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Animal" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Animal" + description: OK + tags: + - default + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: default + /fruits: + post: + operationId: createFruit + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Fruit" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Fruit" + description: OK + tags: + - default + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: default + /beverages: + post: + operationId: createBeverage + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Beverage" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Beverage" + description: OK + tags: + - default + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: default +components: + schemas: + Animal: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + x-jackson-default-impl: Dog + x-one-of-name: Animal + Dog: + example: + bark: true + properties: + bark: + type: boolean + type: object + Cat: + properties: + declawed: + type: boolean + type: object + Fruit: + discriminator: + mapping: + APPLE: "#/components/schemas/Apple" + BANANA: "#/components/schemas/Banana" + propertyName: fruitType + example: + fruitType: fruitType + oneOf: + - $ref: "#/components/schemas/Apple" + - $ref: "#/components/schemas/Banana" + properties: + fruitType: + type: string + required: + - fruitType + type: object + x-one-of-name: Fruit + Apple: + properties: + fruitType: + type: string + seeds: + type: integer + required: + - fruitType + type: object + Banana: + properties: + fruitType: + type: string + length: + type: integer + required: + - fruitType + type: object + Beverage: + discriminator: + mapping: + WATER: "#/components/schemas/Water" + SODA: "#/components/schemas/Soda" + propertyName: beverageType + example: + beverageType: beverageType + oneOf: + - $ref: "#/components/schemas/Water" + - $ref: "#/components/schemas/Soda" + properties: + beverageType: + type: string + required: + - beverageType + type: object + x-jackson-default-impl: Water + x-one-of-name: Beverage + Water: + properties: + beverageType: + type: string + sparkling: + type: boolean + required: + - beverageType + type: object + Soda: + properties: + beverageType: + type: string + sugarGrams: + type: integer + required: + - beverageType + type: object diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java new file mode 100644 index 000000000000..3681f67e7705 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof-jackson-default-impl/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java @@ -0,0 +1,13 @@ +package org.openapitools; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class OpenApiGeneratorApplicationTests { + + @Test + void contextLoads() { + } + +} \ No newline at end of file diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator-ignore b/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator/FILES b/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator/FILES new file mode 100644 index 000000000000..1fa23ce9433e --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator/FILES @@ -0,0 +1,25 @@ +README.md +pom.xml +src/main/java/org/openapitools/OpenApiGeneratorApplication.java +src/main/java/org/openapitools/RFC3339DateFormat.java +src/main/java/org/openapitools/RestConfiguration.java +src/main/java/org/openapitools/ValidationErrorProcessor.java +src/main/java/org/openapitools/api/AnimalsApi.java +src/main/java/org/openapitools/api/AnimalsApiRoutesImpl.java +src/main/java/org/openapitools/api/AnimalsApiValidator.java +src/main/java/org/openapitools/api/BeveragesApi.java +src/main/java/org/openapitools/api/BeveragesApiRoutesImpl.java +src/main/java/org/openapitools/api/BeveragesApiValidator.java +src/main/java/org/openapitools/api/FruitsApi.java +src/main/java/org/openapitools/api/FruitsApiRoutesImpl.java +src/main/java/org/openapitools/api/FruitsApiValidator.java +src/main/java/org/openapitools/model/Animal.java +src/main/java/org/openapitools/model/Apple.java +src/main/java/org/openapitools/model/Banana.java +src/main/java/org/openapitools/model/Beverage.java +src/main/java/org/openapitools/model/Cat.java +src/main/java/org/openapitools/model/Dog.java +src/main/java/org/openapitools/model/Fruit.java +src/main/java/org/openapitools/model/Soda.java +src/main/java/org/openapitools/model/Water.java +src/main/resources/application.properties diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator/VERSION b/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator/VERSION new file mode 100644 index 000000000000..8fc8df61083a --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.25.0-SNAPSHOT diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/README.md b/samples/server/petstore/java-camel-oneof-jackson-default-impl/README.md new file mode 100644 index 000000000000..e20452e84920 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/README.md @@ -0,0 +1,7 @@ +# OpenAPI generated server + +Apache Camel Server + +```bash +mvn clean test +``` \ No newline at end of file diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/pom.xml b/samples/server/petstore/java-camel-oneof-jackson-default-impl/pom.xml new file mode 100644 index 000000000000..2f7c6adb2e8f --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/pom.xml @@ -0,0 +1,172 @@ + + + + 4.0.0 + + org.openapitools + java-camel-oneof-jackson-default-impl + jar + java-camel-oneof-jackson-default-impl + 0.0.1 + + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + http://unlicense.org + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + UTF-8 + 2.7.8 + 3.20.1 + + + + + + org.apache.camel + camel-bom + ${org.apache.camel.version} + pom + import + + + org.apache.camel.springboot + camel-spring-boot-bom + ${org.apache.camel.version} + pom + import + + + org.springframework.boot + spring-boot-dependencies + ${org.springframework.boot.version} + pom + import + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 11 + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + maven-surefire-plugin + 2.22.2 + + + + + + + org.apache.camel.springboot + camel-spring-boot-starter + + + + org.apache.camel.springboot + camel-servlet-starter + + + + org.springframework.boot + spring-boot-starter-web + + + + org.openapitools + jackson-databind-nullable + 0.2.11 + + + io.swagger.core.v3 + swagger-annotations + 2.2.8 + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.15.2 + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + 2.15.2 + + + org.apache.camel + camel-jackson + + + + org.apache.camel + camel-direct + + + + org.apache.camel + camel-bean-validator + + + + + com.mashape.unirest + unirest-java + 1.4.9 + test + + + + org.apache.camel + camel-test-spring-junit5 + test + + + + org.springframework.boot + spring-boot-starter-test + test + + + + diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/OpenApiGeneratorApplication.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/OpenApiGeneratorApplication.java new file mode 100644 index 000000000000..97252a8a9402 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/OpenApiGeneratorApplication.java @@ -0,0 +1,30 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.Module; +import org.openapitools.jackson.nullable.JsonNullableModule; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator; + +@SpringBootApplication( + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +@ComponentScan( + basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}, + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +public class OpenApiGeneratorApplication { + + public static void main(String[] args) { + SpringApplication.run(OpenApiGeneratorApplication.class, args); + } + + @Bean(name = "org.openapitools.OpenApiGeneratorApplication.jsonNullableModule") + public Module jsonNullableModule() { + return new JsonNullableModule(); + } + +} \ No newline at end of file diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/RFC3339DateFormat.java new file mode 100644 index 000000000000..bcd3936d8b34 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -0,0 +1,38 @@ +package org.openapitools; + +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, 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; + } +} \ No newline at end of file diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/RestConfiguration.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/RestConfiguration.java new file mode 100644 index 000000000000..fcae55f5d9a8 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/RestConfiguration.java @@ -0,0 +1,26 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; +import org.apache.camel.model.rest.RestBindingMode; + +@Component +public class RestConfiguration extends RouteBuilder { + @Override + public void configure() throws Exception { + restConfiguration() + .scheme("http") + .host("localhost") + .component("servlet") + .bindingMode(RestBindingMode.auto) + .dataFormatProperty("json.out.disableFeatures", "WRITE_DATES_AS_TIMESTAMPS") + .clientRequestValidation(true) + .apiProperty("api.title", "Jackson defaultImpl oneOf sample") + .apiProperty("api.version", "0.0.1"); + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/ValidationErrorProcessor.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/ValidationErrorProcessor.java new file mode 100644 index 000000000000..025309f324e6 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/ValidationErrorProcessor.java @@ -0,0 +1,30 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.component.bean.validator.BeanValidationException; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; + +@Component("validationErrorProcessor") +public class ValidationErrorProcessor implements Processor { + + @Override + public void process(Exchange exchange) throws Exception { + Exception fault = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class); + int httpStatusCode = 500; + if (fault instanceof BeanValidationException) { + httpStatusCode = 400; + } + if (fault instanceof UnrecognizedPropertyException) { + httpStatusCode = 400; + } + exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE, httpStatusCode); + exchange.getIn().setBody(fault.getMessage()); + } +} \ No newline at end of file diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApi.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApi.java new file mode 100644 index 000000000000..f5734cdb6b45 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApi.java @@ -0,0 +1,46 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.model.rest.RestParamType; +import org.springframework.stereotype.Component; +import org.openapitools.model.*; +import org.apache.camel.model.rest.RestBindingMode; +import org.apache.camel.LoggingLevel; + +@Component +public class AnimalsApi extends RouteBuilder { + + @Override + public void configure() throws Exception { + onException(Exception.class) + .log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}") + .handled(true) + .process("validationErrorProcessor"); + + + /** + POST /animals + **/ + rest() + .post("/animals") + .description("") + .id("createAnimalApi") + .produces("application/json") + .outType(Animal.class) + .consumes("application/json") + .type(Animal.class) + + .param() + .name("animal") + .type(RestParamType.body) + .required(true) + .endParam() + .to("direct:validate-createAnimal"); + + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiRoutesImpl.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiRoutesImpl.java new file mode 100644 index 000000000000..fac967846a7b --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiRoutesImpl.java @@ -0,0 +1,32 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; +import org.apache.camel.LoggingLevel; +import org.openapitools.model.*; +import org.apache.camel.model.dataformat.JsonLibrary; + +@Component +public class AnimalsApiRoutesImpl extends RouteBuilder { + @Override + public void configure() throws Exception { + + /** + POST /animals + **/ + from("direct:createAnimal") + .id("createAnimal") + .choice() + .when(simple("${body} != null")) + .log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}") + .end() + .log(LoggingLevel.INFO, "HEADERS: ${headers}") + .setBody(constant("{ \"bark\" : true }")) + .unmarshal().json(JsonLibrary.Jackson, Animal.class); + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiValidator.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiValidator.java new file mode 100644 index 000000000000..b1b2434fa5a0 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/AnimalsApiValidator.java @@ -0,0 +1,28 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; +import org.apache.camel.LoggingLevel; + +@Component +public class AnimalsApiValidator extends RouteBuilder { + @Override + public void configure() throws Exception { + onException(Exception.class) + .log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}") + .handled(true) + .process("validationErrorProcessor"); + + from("direct:validate-createAnimal") + .id("validate-createAnimal") + .to("bean-validator://validate-request") + .to("direct:createAnimal") + .to("bean-validator://validate-response"); + + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApi.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApi.java new file mode 100644 index 000000000000..809059817bbd --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApi.java @@ -0,0 +1,46 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.model.rest.RestParamType; +import org.springframework.stereotype.Component; +import org.openapitools.model.*; +import org.apache.camel.model.rest.RestBindingMode; +import org.apache.camel.LoggingLevel; + +@Component +public class BeveragesApi extends RouteBuilder { + + @Override + public void configure() throws Exception { + onException(Exception.class) + .log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}") + .handled(true) + .process("validationErrorProcessor"); + + + /** + POST /beverages + **/ + rest() + .post("/beverages") + .description("") + .id("createBeverageApi") + .produces("application/json") + .outType(Beverage.class) + .consumes("application/json") + .type(Beverage.class) + + .param() + .name("beverage") + .type(RestParamType.body) + .required(true) + .endParam() + .to("direct:validate-createBeverage"); + + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiRoutesImpl.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiRoutesImpl.java new file mode 100644 index 000000000000..4e22f5095080 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiRoutesImpl.java @@ -0,0 +1,32 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; +import org.apache.camel.LoggingLevel; +import org.openapitools.model.*; +import org.apache.camel.model.dataformat.JsonLibrary; + +@Component +public class BeveragesApiRoutesImpl extends RouteBuilder { + @Override + public void configure() throws Exception { + + /** + POST /beverages + **/ + from("direct:createBeverage") + .id("createBeverage") + .choice() + .when(simple("${body} != null")) + .log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}") + .end() + .log(LoggingLevel.INFO, "HEADERS: ${headers}") + .setBody(constant("{ \"beverageType\" : \"beverageType\" }")) + .unmarshal().json(JsonLibrary.Jackson, Beverage.class); + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiValidator.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiValidator.java new file mode 100644 index 000000000000..738a1e05f0ca --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/BeveragesApiValidator.java @@ -0,0 +1,28 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; +import org.apache.camel.LoggingLevel; + +@Component +public class BeveragesApiValidator extends RouteBuilder { + @Override + public void configure() throws Exception { + onException(Exception.class) + .log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}") + .handled(true) + .process("validationErrorProcessor"); + + from("direct:validate-createBeverage") + .id("validate-createBeverage") + .to("bean-validator://validate-request") + .to("direct:createBeverage") + .to("bean-validator://validate-response"); + + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApi.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApi.java new file mode 100644 index 000000000000..afd432a2de01 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApi.java @@ -0,0 +1,46 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.model.rest.RestParamType; +import org.springframework.stereotype.Component; +import org.openapitools.model.*; +import org.apache.camel.model.rest.RestBindingMode; +import org.apache.camel.LoggingLevel; + +@Component +public class FruitsApi extends RouteBuilder { + + @Override + public void configure() throws Exception { + onException(Exception.class) + .log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}") + .handled(true) + .process("validationErrorProcessor"); + + + /** + POST /fruits + **/ + rest() + .post("/fruits") + .description("") + .id("createFruitApi") + .produces("application/json") + .outType(Fruit.class) + .consumes("application/json") + .type(Fruit.class) + + .param() + .name("fruit") + .type(RestParamType.body) + .required(true) + .endParam() + .to("direct:validate-createFruit"); + + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiRoutesImpl.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiRoutesImpl.java new file mode 100644 index 000000000000..9f8b1d685432 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiRoutesImpl.java @@ -0,0 +1,32 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; +import org.apache.camel.LoggingLevel; +import org.openapitools.model.*; +import org.apache.camel.model.dataformat.JsonLibrary; + +@Component +public class FruitsApiRoutesImpl extends RouteBuilder { + @Override + public void configure() throws Exception { + + /** + POST /fruits + **/ + from("direct:createFruit") + .id("createFruit") + .choice() + .when(simple("${body} != null")) + .log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}") + .end() + .log(LoggingLevel.INFO, "HEADERS: ${headers}") + .setBody(constant("{ \"fruitType\" : \"fruitType\" }")) + .unmarshal().json(JsonLibrary.Jackson, Fruit.class); + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiValidator.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiValidator.java new file mode 100644 index 000000000000..73a8642330fc --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/api/FruitsApiValidator.java @@ -0,0 +1,28 @@ +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.api; + +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; +import org.apache.camel.LoggingLevel; + +@Component +public class FruitsApiValidator extends RouteBuilder { + @Override + public void configure() throws Exception { + onException(Exception.class) + .log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}") + .handled(true) + .process("validationErrorProcessor"); + + from("direct:validate-createFruit") + .id("validate-createFruit") + .to("bean-validator://validate-request") + .to("direct:createFruit") + .to("bean-validator://validate-response"); + + } +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Animal.java new file mode 100644 index 000000000000..7c4fe901190c --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Animal.java @@ -0,0 +1,32 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openapitools.model.Cat; +import org.openapitools.model.Dog; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + + +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class), + @JsonSubTypes.Type(value = Cat.class) +}) +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public interface Animal { +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Apple.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Apple.java new file mode 100644 index 000000000000..baeb205b296e --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Apple.java @@ -0,0 +1,122 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * Apple + */ + +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Apple implements Fruit { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String fruitType; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private Integer seeds; + + public Apple() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Apple(String fruitType) { + this.fruitType = fruitType; + } + + public Apple fruitType(String fruitType) { + this.fruitType = fruitType; + return this; + } + + /** + * Get fruitType + * @return fruitType + */ + @NotNull + @Schema(name = "fruitType", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("fruitType") + public String getFruitType() { + return fruitType; + } + + public void setFruitType(String fruitType) { + this.fruitType = fruitType; + } + + public Apple seeds(Integer seeds) { + this.seeds = seeds; + return this; + } + + /** + * Get seeds + * @return seeds + */ + + @Schema(name = "seeds", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("seeds") + public Integer getSeeds() { + return seeds; + } + + public void setSeeds(Integer seeds) { + this.seeds = seeds; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Apple apple = (Apple) o; + return Objects.equals(this.fruitType, apple.fruitType) && + Objects.equals(this.seeds, apple.seeds); + } + + @Override + public int hashCode() { + return Objects.hash(fruitType, seeds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Apple {\n"); + sb.append(" fruitType: ").append(toIndentedString(fruitType)).append("\n"); + sb.append(" seeds: ").append(toIndentedString(seeds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Banana.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Banana.java new file mode 100644 index 000000000000..1d2c570cf5ae --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Banana.java @@ -0,0 +1,122 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * Banana + */ + +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Banana implements Fruit { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String fruitType; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private Integer length; + + public Banana() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Banana(String fruitType) { + this.fruitType = fruitType; + } + + public Banana fruitType(String fruitType) { + this.fruitType = fruitType; + return this; + } + + /** + * Get fruitType + * @return fruitType + */ + @NotNull + @Schema(name = "fruitType", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("fruitType") + public String getFruitType() { + return fruitType; + } + + public void setFruitType(String fruitType) { + this.fruitType = fruitType; + } + + public Banana length(Integer length) { + this.length = length; + return this; + } + + /** + * Get length + * @return length + */ + + @Schema(name = "length", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("length") + public Integer getLength() { + return length; + } + + public void setLength(Integer length) { + this.length = length; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Banana banana = (Banana) o; + return Objects.equals(this.fruitType, banana.fruitType) && + Objects.equals(this.length, banana.length); + } + + @Override + public int hashCode() { + return Objects.hash(fruitType, length); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banana {\n"); + sb.append(" fruitType: ").append(toIndentedString(fruitType)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Beverage.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Beverage.java new file mode 100644 index 000000000000..fa80f78bf70c --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Beverage.java @@ -0,0 +1,38 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.Soda; +import org.openapitools.model.Water; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "beverageType", // ignore manually set beverageType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the beverageType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "beverageType", visible = true, defaultImpl = Water.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Soda.class, name = "SODA"), + @JsonSubTypes.Type(value = Water.class, name = "WATER") +}) + +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public interface Beverage { + public String getBeverageType(); +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Cat.java new file mode 100644 index 000000000000..7cad4242d68b --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Cat.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * Cat + */ + +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Cat implements Animal { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private Boolean declawed; + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + + @Schema(name = "declawed", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("declawed") + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Dog.java new file mode 100644 index 000000000000..ae66f9e791b0 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Dog.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * Dog + */ + +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Dog implements Animal { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private Boolean bark; + + public Dog bark(Boolean bark) { + this.bark = bark; + return this; + } + + /** + * Get bark + * @return bark + */ + + @Schema(name = "bark", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("bark") + public Boolean getBark() { + return bark; + } + + public void setBark(Boolean bark) { + this.bark = bark; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.bark, dog.bark); + } + + @Override + public int hashCode() { + return Objects.hash(bark); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" bark: ").append(toIndentedString(bark)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Fruit.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Fruit.java new file mode 100644 index 000000000000..05a2c003939d --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Fruit.java @@ -0,0 +1,38 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.Apple; +import org.openapitools.model.Banana; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "fruitType", // ignore manually set fruitType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the fruitType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fruitType", visible = true, defaultImpl = Apple.class) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Apple.class, name = "APPLE"), + @JsonSubTypes.Type(value = Banana.class, name = "BANANA") +}) + +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public interface Fruit { + public String getFruitType(); +} diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Soda.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Soda.java new file mode 100644 index 000000000000..d7792de5ecff --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Soda.java @@ -0,0 +1,122 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * Soda + */ + +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Soda implements Beverage { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String beverageType; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private Integer sugarGrams; + + public Soda() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Soda(String beverageType) { + this.beverageType = beverageType; + } + + public Soda beverageType(String beverageType) { + this.beverageType = beverageType; + return this; + } + + /** + * Get beverageType + * @return beverageType + */ + @NotNull + @Schema(name = "beverageType", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("beverageType") + public String getBeverageType() { + return beverageType; + } + + public void setBeverageType(String beverageType) { + this.beverageType = beverageType; + } + + public Soda sugarGrams(Integer sugarGrams) { + this.sugarGrams = sugarGrams; + return this; + } + + /** + * Get sugarGrams + * @return sugarGrams + */ + + @Schema(name = "sugarGrams", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("sugarGrams") + public Integer getSugarGrams() { + return sugarGrams; + } + + public void setSugarGrams(Integer sugarGrams) { + this.sugarGrams = sugarGrams; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Soda soda = (Soda) o; + return Objects.equals(this.beverageType, soda.beverageType) && + Objects.equals(this.sugarGrams, soda.sugarGrams); + } + + @Override + public int hashCode() { + return Objects.hash(beverageType, sugarGrams); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" beverageType: ").append(toIndentedString(beverageType)).append("\n"); + sb.append(" sugarGrams: ").append(toIndentedString(sugarGrams)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Water.java b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Water.java new file mode 100644 index 000000000000..76804672d449 --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/java/org/openapitools/model/Water.java @@ -0,0 +1,122 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import org.hibernate.validator.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * Water + */ + +@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class Water implements Beverage { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String beverageType; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private Boolean sparkling; + + public Water() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Water(String beverageType) { + this.beverageType = beverageType; + } + + public Water beverageType(String beverageType) { + this.beverageType = beverageType; + return this; + } + + /** + * Get beverageType + * @return beverageType + */ + @NotNull + @Schema(name = "beverageType", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("beverageType") + public String getBeverageType() { + return beverageType; + } + + public void setBeverageType(String beverageType) { + this.beverageType = beverageType; + } + + public Water sparkling(Boolean sparkling) { + this.sparkling = sparkling; + return this; + } + + /** + * Get sparkling + * @return sparkling + */ + + @Schema(name = "sparkling", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("sparkling") + public Boolean getSparkling() { + return sparkling; + } + + public void setSparkling(Boolean sparkling) { + this.sparkling = sparkling; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Water water = (Water) o; + return Objects.equals(this.beverageType, water.beverageType) && + Objects.equals(this.sparkling, water.sparkling); + } + + @Override + public int hashCode() { + return Objects.hash(beverageType, sparkling); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Water {\n"); + sb.append(" beverageType: ").append(toIndentedString(beverageType)).append("\n"); + sb.append(" sparkling: ").append(toIndentedString(sparkling)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/resources/application.properties b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/resources/application.properties new file mode 100644 index 000000000000..4d2536c758bb --- /dev/null +++ b/samples/server/petstore/java-camel-oneof-jackson-default-impl/src/main/resources/application.properties @@ -0,0 +1,8 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). +# https://openapi-generator.tech +# Do not edit the class manually. + +camel.springboot.name=camel-java-camel-oneof-jackson-default-impl +camel.servlet.mapping.context-path=/api/v1/* + +server.port=8080 \ No newline at end of file diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator-ignore b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator/FILES b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator/FILES new file mode 100644 index 000000000000..939668c02cfc --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator/FILES @@ -0,0 +1,22 @@ +README.md +build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/kotlin/org/openapitools/api/AnimalsApi.kt +src/main/kotlin/org/openapitools/api/ApiUtil.kt +src/main/kotlin/org/openapitools/api/BeveragesApi.kt +src/main/kotlin/org/openapitools/api/Exceptions.kt +src/main/kotlin/org/openapitools/api/FruitsApi.kt +src/main/kotlin/org/openapitools/model/Animal.kt +src/main/kotlin/org/openapitools/model/Apple.kt +src/main/kotlin/org/openapitools/model/Banana.kt +src/main/kotlin/org/openapitools/model/Beverage.kt +src/main/kotlin/org/openapitools/model/Cat.kt +src/main/kotlin/org/openapitools/model/Dog.kt +src/main/kotlin/org/openapitools/model/Fruit.kt +src/main/kotlin/org/openapitools/model/Soda.kt +src/main/kotlin/org/openapitools/model/Water.kt diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator/VERSION b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator/VERSION new file mode 100644 index 000000000000..8fc8df61083a --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.25.0-SNAPSHOT diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/README.md b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/README.md new file mode 100644 index 000000000000..5d4e52b50c5d --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/README.md @@ -0,0 +1,21 @@ +# jacksonDefaultImplOneOfSample + +This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). + +## Getting Started + +This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in. + +By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl). + +To build the project using maven, run: +```bash +mvn package && java -jar target/kotlin-spring-oneof-jackson-default-impl-1.0.0.jar +``` + +To build the project using gradle, run: +```bash +gradle build && java -jar build/libs/kotlin-spring-oneof-jackson-default-impl-1.0.0.jar +``` + +If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/) diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/build.gradle.kts b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/build.gradle.kts new file mode 100644 index 000000000000..30b6a49c9bf6 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/build.gradle.kts @@ -0,0 +1,49 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +group = "org.openapitools" +version = "1.0.0" +java.sourceCompatibility = JavaVersion.VERSION_17 + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/milestone") } +} + +tasks.withType { + kotlinOptions.jvmTarget = "17" +} + +tasks.bootJar { + enabled = false +} + +plugins { + val kotlinVersion = "1.9.25" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "3.3.13" + id("io.spring.dependency-management") version "1.1.7" +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation("org.jetbrains.kotlin:kotlin-reflect") + implementation("org.springframework.boot:spring-boot-starter-web") + + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin") + implementation("org.springframework.data:spring-data-commons") + implementation("org.springframework.boot:spring-boot-starter-validation") + implementation("jakarta.validation:jakarta.validation-api") + + implementation("jakarta.annotation:jakarta.annotation-api:2.1.0") + + testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") + testImplementation("org.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } +} diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradlew b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradlew.bat b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/pom.xml b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/pom.xml new file mode 100644 index 000000000000..43cb31f6e93c --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/pom.xml @@ -0,0 +1,158 @@ + + 4.0.0 + org.openapitools + kotlin-spring-oneof-jackson-default-impl + jar + kotlin-spring-oneof-jackson-default-impl + 1.0.0 + + 3.0.2 + 2.1.0 + 1.9.25 + + 1.9.25 + UTF-8 + + + org.springframework.boot + spring-boot-starter-parent + 3.3.13 + + + + repository.spring.milestone + Spring Milestone Repository + https://repo.spring.io/milestone + + + + + spring-milestones + https://repo.spring.io/milestone + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + spring + + 17 + + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + + org.jetbrains.kotlin + kotlin-maven-allopen + ${kotlin.version} + + + + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.data + spring-data-commons + + + + + + + com.google.code.findbugs + jsr305 + ${findbugs-jsr305.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-kotlin + + + + jakarta.validation + jakarta.validation-api + + + org.springframework.boot + spring-boot-starter-validation + + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation.version} + provided + + + org.springframework.boot + spring-boot-starter-test + test + + + org.jetbrains.kotlin + kotlin-test-junit5 + ${kotlin-test-junit5.version} + test + + + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/settings.gradle b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/settings.gradle new file mode 100644 index 000000000000..7e501c409e45 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/settings.gradle @@ -0,0 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} +rootProject.name = "kotlin-spring-oneof-jackson-default-impl" diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/AnimalsApi.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/AnimalsApi.kt new file mode 100644 index 000000000000..5594e926b19d --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/AnimalsApi.kt @@ -0,0 +1,53 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. +*/ +package org.openapitools.api + +import org.openapitools.model.Animal +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.* +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +interface AnimalsApi { + + + @RequestMapping( + method = [RequestMethod.POST], + // "/animals" + value = [PATH_CREATE_ANIMAL], + produces = ["application/json"], + consumes = ["application/json"] + ) + fun createAnimal( + @Valid @RequestBody animal: Animal + ): ResponseEntity { + return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) + } + + companion object { + //for your own safety never directly reuse these path definitions in tests + const val PATH_CREATE_ANIMAL: String = "/animals" + } +} diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/ApiUtil.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/ApiUtil.kt new file mode 100644 index 000000000000..03344e13b474 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/ApiUtil.kt @@ -0,0 +1,19 @@ +package org.openapitools.api + +import org.springframework.web.context.request.NativeWebRequest + +import jakarta.servlet.http.HttpServletResponse +import java.io.IOException + +object ApiUtil { + fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) { + try { + val res = req.getNativeResponse(HttpServletResponse::class.java) + res?.characterEncoding = "UTF-8" + res?.addHeader("Content-Type", contentType) + res?.writer?.print(example) + } catch (e: IOException) { + throw RuntimeException(e) + } + } +} diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/BeveragesApi.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/BeveragesApi.kt new file mode 100644 index 000000000000..d3d549355f64 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/BeveragesApi.kt @@ -0,0 +1,53 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. +*/ +package org.openapitools.api + +import org.openapitools.model.Beverage +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.* +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +interface BeveragesApi { + + + @RequestMapping( + method = [RequestMethod.POST], + // "/beverages" + value = [PATH_CREATE_BEVERAGE], + produces = ["application/json"], + consumes = ["application/json"] + ) + fun createBeverage( + @Valid @RequestBody beverage: Beverage + ): ResponseEntity { + return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) + } + + companion object { + //for your own safety never directly reuse these path definitions in tests + const val PATH_CREATE_BEVERAGE: String = "/beverages" + } +} diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/Exceptions.kt new file mode 100644 index 000000000000..1bd78f54576a --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/Exceptions.kt @@ -0,0 +1,30 @@ +package org.openapitools.api + +import org.springframework.context.annotation.Configuration +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.ControllerAdvice +import org.springframework.web.bind.annotation.ExceptionHandler +import jakarta.servlet.http.HttpServletResponse +import jakarta.validation.ConstraintViolationException + +// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception +sealed class ApiException(msg: String, val code: Int) : Exception(msg) + +class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code) + +@Configuration("org.openapitools.api.DefaultExceptionHandler") +@ControllerAdvice +class DefaultExceptionHandler { + + @ExceptionHandler(value = [ApiException::class]) + fun onApiException(ex: ApiException, response: HttpServletResponse): Unit = + response.sendError(ex.code, ex.message) + + @ExceptionHandler(value = [NotImplementedError::class]) + fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.NOT_IMPLEMENTED.value()) + + @ExceptionHandler(value = [ConstraintViolationException::class]) + fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message }) +} diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/FruitsApi.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/FruitsApi.kt new file mode 100644 index 000000000000..554902f5e7dd --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/api/FruitsApi.kt @@ -0,0 +1,53 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. +*/ +package org.openapitools.api + +import org.openapitools.model.Fruit +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.* +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +interface FruitsApi { + + + @RequestMapping( + method = [RequestMethod.POST], + // "/fruits" + value = [PATH_CREATE_FRUIT], + produces = ["application/json"], + consumes = ["application/json"] + ) + fun createFruit( + @Valid @RequestBody fruit: Fruit + ): ResponseEntity { + return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) + } + + companion object { + //for your own safety never directly reuse these path definitions in tests + const val PATH_CREATE_FRUIT: String = "/fruits" + } +} diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Animal.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Animal.kt new file mode 100644 index 000000000000..36bfa5093b32 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Animal.kt @@ -0,0 +1,34 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls +import org.openapitools.model.Cat +import org.openapitools.model.Dog +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + */ + +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = Dog::class) +@JsonSubTypes( + JsonSubTypes.Type(value = Dog::class), + JsonSubTypes.Type(value = Cat::class) +) +sealed interface Animal { +} + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Apple.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Apple.kt new file mode 100644 index 000000000000..77b0b517da3b --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Apple.kt @@ -0,0 +1,39 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + * @param fruitType + * @param seeds + */ +data class Apple( + + @field:JsonInclude(JsonInclude.Include.ALWAYS) + @param:JsonProperty("fruitType") + @get:JsonProperty("fruitType", required = true) override val fruitType: kotlin.String = "APPLE", + + @field:JsonInclude(JsonInclude.Include.NON_NULL) + @field:JsonSetter(nulls = Nulls.SKIP) + @param:JsonProperty("seeds") + @get:JsonProperty("seeds") val seeds: kotlin.Int? = null +) : Fruit { + +} + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Banana.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Banana.kt new file mode 100644 index 000000000000..75e5b1acbef1 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Banana.kt @@ -0,0 +1,39 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + * @param fruitType + * @param length + */ +data class Banana( + + @field:JsonInclude(JsonInclude.Include.ALWAYS) + @param:JsonProperty("fruitType") + @get:JsonProperty("fruitType", required = true) override val fruitType: kotlin.String = "BANANA", + + @field:JsonInclude(JsonInclude.Include.NON_NULL) + @field:JsonSetter(nulls = Nulls.SKIP) + @param:JsonProperty("length") + @get:JsonProperty("length") val length: kotlin.Int? = null +) : Fruit { + +} + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Beverage.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Beverage.kt new file mode 100644 index 000000000000..51617977efd8 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Beverage.kt @@ -0,0 +1,38 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.Nulls +import org.openapitools.model.Soda +import org.openapitools.model.Water +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + */ +@JsonIgnoreProperties( + value = ["beverageType"], // ignore manually set beverageType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the beverageType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "beverageType", visible = true, defaultImpl = Water::class) +@JsonSubTypes( + JsonSubTypes.Type(value = Soda::class, name = "SODA"), + JsonSubTypes.Type(value = Water::class, name = "WATER") +) +sealed interface Beverage { + val beverageType: kotlin.String +} + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Cat.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Cat.kt new file mode 100644 index 000000000000..59ee6e3977b5 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Cat.kt @@ -0,0 +1,31 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + * @param declawed + */ +data class Cat( + + @field:JsonInclude(JsonInclude.Include.NON_NULL) + @field:JsonSetter(nulls = Nulls.SKIP) + @param:JsonProperty("declawed") + @get:JsonProperty("declawed") val declawed: kotlin.Boolean? = null +) : Animal { + +} + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Dog.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Dog.kt new file mode 100644 index 000000000000..69603f0779cf --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Dog.kt @@ -0,0 +1,31 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + * @param bark + */ +data class Dog( + + @field:JsonInclude(JsonInclude.Include.NON_NULL) + @field:JsonSetter(nulls = Nulls.SKIP) + @param:JsonProperty("bark") + @get:JsonProperty("bark") val bark: kotlin.Boolean? = null +) : Animal { + +} + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Fruit.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Fruit.kt new file mode 100644 index 000000000000..53968a634b29 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Fruit.kt @@ -0,0 +1,38 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.Nulls +import org.openapitools.model.Apple +import org.openapitools.model.Banana +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + */ +@JsonIgnoreProperties( + value = ["fruitType"], // ignore manually set fruitType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the fruitType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fruitType", visible = true, defaultImpl = Apple::class) +@JsonSubTypes( + JsonSubTypes.Type(value = Apple::class, name = "APPLE"), + JsonSubTypes.Type(value = Banana::class, name = "BANANA") +) +sealed interface Fruit { + val fruitType: kotlin.String +} + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Soda.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Soda.kt new file mode 100644 index 000000000000..74abcdad3036 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Soda.kt @@ -0,0 +1,39 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + * @param beverageType + * @param sugarGrams + */ +data class Soda( + + @field:JsonInclude(JsonInclude.Include.ALWAYS) + @param:JsonProperty("beverageType") + @get:JsonProperty("beverageType", required = true) override val beverageType: kotlin.String = "SODA", + + @field:JsonInclude(JsonInclude.Include.NON_NULL) + @field:JsonSetter(nulls = Nulls.SKIP) + @param:JsonProperty("sugarGrams") + @get:JsonProperty("sugarGrams") val sugarGrams: kotlin.Int? = null +) : Beverage { + +} + diff --git a/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Water.kt b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Water.kt new file mode 100644 index 000000000000..1f5bf5e5fae6 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-oneof-jackson-default-impl/src/main/kotlin/org/openapitools/model/Water.kt @@ -0,0 +1,39 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import jakarta.validation.constraints.DecimalMax +import jakarta.validation.constraints.DecimalMin +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.Max +import jakarta.validation.constraints.Min +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern +import jakarta.validation.constraints.Size +import jakarta.validation.Valid + +/** + * + * @param beverageType + * @param sparkling + */ +data class Water( + + @field:JsonInclude(JsonInclude.Include.ALWAYS) + @param:JsonProperty("beverageType") + @get:JsonProperty("beverageType", required = true) override val beverageType: kotlin.String = "WATER", + + @field:JsonInclude(JsonInclude.Include.NON_NULL) + @field:JsonSetter(nulls = Nulls.SKIP) + @param:JsonProperty("sparkling") + @get:JsonProperty("sparkling") val sparkling: kotlin.Boolean? = null +) : Beverage { + +} +