diff --git a/.github/workflows/samples-java-server-jdk8.yaml b/.github/workflows/samples-java-server-jdk8.yaml
index 51de7249423f..56694212c969 100644
--- a/.github/workflows/samples-java-server-jdk8.yaml
+++ b/.github/workflows/samples-java-server-jdk8.yaml
@@ -10,6 +10,7 @@ on:
- 'samples/server/petstore/java-pkmst/**'
# test in circleci instead
- 'samples/server/petstore/java-undertow/**'
+ - 'samples/server/petstore/java-microprofile/**'
pull_request:
paths:
#- 'samples/server/petstore/java-camel/**'
@@ -17,6 +18,7 @@ on:
- 'samples/server/petstore/java-inflector/**'
- 'samples/server/petstore/java-pkmst/**'
#- 'samples/server/petstore/java-undertow/**'
+ - 'samples/server/petstore/java-microprofile/**'
jobs:
build:
name: Build Java Server
@@ -31,6 +33,7 @@ jobs:
- samples/server/petstore/java-inflector/
- samples/server/petstore/java-pkmst/
#- samples/server/petstore/java-undertow/
+ - samples/server/petstore/java-microprofile/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
diff --git a/.github/workflows/samples-kotlin-client.yaml b/.github/workflows/samples-kotlin-client.yaml
index ab5b2c91b59e..9689c0d02b6d 100644
--- a/.github/workflows/samples-kotlin-client.yaml
+++ b/.github/workflows/samples-kotlin-client.yaml
@@ -10,9 +10,6 @@ on:
- 'samples/client/petstore/kotlin*/**'
- 'samples/client/others/kotlin-jvm-okhttp-parameter-tests/**'
-env:
- GRADLE_VERSION: 6.9
-
jobs:
build:
name: Build Kotlin client
@@ -65,7 +62,6 @@ jobs:
- samples/client/echo_api/kotlin-jvm-spring-3-webclient
- samples/client/petstore/kotlin-jvm-spring-3-restclient
- samples/client/echo_api/kotlin-jvm-spring-3-restclient
- - samples/client/petstore/kotlin-spring-cloud
- samples/client/petstore/kotlin-name-parameter-mappings
- samples/client/others/kotlin-jvm-okhttp-parameter-tests
steps:
@@ -73,7 +69,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
- java-version: 8
+ java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v4
env:
@@ -85,7 +81,6 @@ jobs:
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v3
with:
- gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}
arguments: wrapper
- name: Build
diff --git a/.github/workflows/samples-kotlin-echo-api.yaml b/.github/workflows/samples-kotlin-echo-api.yaml
index f4fc53d0c5ae..0d92c30383bf 100644
--- a/.github/workflows/samples-kotlin-echo-api.yaml
+++ b/.github/workflows/samples-kotlin-echo-api.yaml
@@ -7,8 +7,7 @@ on:
pull_request:
paths:
- samples/client/echo_api/kotlin**
-env:
- GRADLE_VERSION: 7.4
+
jobs:
build:
name: Build Kotlin Client JDK17
@@ -37,7 +36,6 @@ jobs:
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v3
with:
- gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}
arguments: wrapper
- name: Setup node.js
diff --git a/.github/workflows/samples-kotlin-server.yaml b/.github/workflows/samples-kotlin-server.yaml
index 5f76d2fb9bcf..b98d4c69532a 100644
--- a/.github/workflows/samples-kotlin-server.yaml
+++ b/.github/workflows/samples-kotlin-server.yaml
@@ -43,6 +43,7 @@ jobs:
- samples/server/petstore/kotlin-server/javalin
- samples/server/others/kotlin-server/jaxrs-spec
- samples/server/others/kotlin-server/jaxrs-spec-array-response
+ - samples/server/petstore/kotlin-spring-cloud
# comment out due to gradle build failure
#- samples/server/petstore/kotlin-spring-default
# no build.gradle file
diff --git a/.sdkmanrc b/.sdkmanrc
new file mode 100644
index 000000000000..f9967f3a5db6
--- /dev/null
+++ b/.sdkmanrc
@@ -0,0 +1,2 @@
+java=11.0.23-tem
+maven=3.8.8
diff --git a/README.md b/README.md
index 84ce04142c02..31ac8d785762 100644
--- a/README.md
+++ b/README.md
@@ -260,7 +260,7 @@ To build from source, you need the following installed and available in your `$P
* [Java 11](https://adoptium.net/)
-* [Apache Maven 3.3.4 or greater](https://maven.apache.org/) (optional)
+* [Apache Maven 3.8.8 or greater](https://maven.apache.org/) (optional)
After cloning the project, you can build it from source using [maven wrapper](https://maven.apache.org/wrapper/):
diff --git a/bin/configs/cpp-pistache-server-cpp-pistache-everything.yaml b/bin/configs/cpp-pistache-server-cpp-pistache-everything.yaml
new file mode 100644
index 000000000000..b18ff7270d94
--- /dev/null
+++ b/bin/configs/cpp-pistache-server-cpp-pistache-everything.yaml
@@ -0,0 +1,7 @@
+generatorName: cpp-pistache-server
+outputDir: samples/server/petstore/cpp-pistache-everything
+inputSpec: modules/openapi-generator/src/test/resources/3_0/issues-anytype-object-set-petstore-everything.yaml
+templateDir: modules/openapi-generator/src/main/resources/cpp-pistache-server
+additionalProperties:
+ useStructModel: "false"
+ addExternalLibs: "true"
diff --git a/bin/configs/cpp-pistache-server-cpp-pistache-nested-schema-refs.yaml b/bin/configs/cpp-pistache-server-cpp-pistache-nested-schema-refs.yaml
new file mode 100644
index 000000000000..32657b4cf378
--- /dev/null
+++ b/bin/configs/cpp-pistache-server-cpp-pistache-nested-schema-refs.yaml
@@ -0,0 +1,7 @@
+generatorName: cpp-pistache-server
+outputDir: samples/server/petstore/cpp-pistache-nested-schema-refs
+inputSpec: modules/openapi-generator/src/test/resources/3_0/nested-schema-refs.yaml
+templateDir: modules/openapi-generator/src/main/resources/cpp-pistache-server
+additionalProperties:
+ useStructModel: "false"
+ addExternalLibs: "true"
diff --git a/bin/configs/java-microprofile-rest-client.yaml b/bin/configs/java-microprofile-rest-client.yaml
index 384a6aa7f300..325cebe61ca8 100644
--- a/bin/configs/java-microprofile-rest-client.yaml
+++ b/bin/configs/java-microprofile-rest-client.yaml
@@ -1,8 +1,8 @@
generatorName: java
outputDir: samples/client/petstore/java/microprofile-rest-client
library: microprofile
-inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
+inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: microprofile-rest-client
- configKey: petstore
+ configKeyFromClassName: true
diff --git a/bin/configs/java-microprofile-server-multiple-2xx-responses.yaml b/bin/configs/java-microprofile-server-multiple-2xx-responses.yaml
new file mode 100644
index 000000000000..44bf605f09e3
--- /dev/null
+++ b/bin/configs/java-microprofile-server-multiple-2xx-responses.yaml
@@ -0,0 +1,8 @@
+generatorName: java-microprofile
+outputDir: samples/server/petstore/java-microprofile
+inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-multiple-2xx-responses.yaml
+templateDir: modules/openapi-generator/src/main/resources/Java
+additionalProperties:
+ hideGenerationTimestamp: "true"
+ microprofileMutiny: "true"
+ serializationLibrary: "jackson"
diff --git a/bin/configs/jaxrs-spec.yaml b/bin/configs/jaxrs-spec.yaml
index dbbb86bb4208..0eca24e42590 100644
--- a/bin/configs/jaxrs-spec.yaml
+++ b/bin/configs/jaxrs-spec.yaml
@@ -1,6 +1,6 @@
generatorName: jaxrs-spec
outputDir: samples/server/petstore/jaxrs-spec
-inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
+inputSpec: modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec
additionalProperties:
artifactId: jaxrs-spec-petstore-server
diff --git a/bin/configs/kotlin-jvm-spring-3-webclient-echo-api.yaml b/bin/configs/kotlin-jvm-spring-3-webclient-echo-api.yaml
index ddafa03ed687..ac7972643cd1 100644
--- a/bin/configs/kotlin-jvm-spring-3-webclient-echo-api.yaml
+++ b/bin/configs/kotlin-jvm-spring-3-webclient-echo-api.yaml
@@ -1,6 +1,6 @@
generatorName: kotlin
outputDir: samples/client/echo_api/kotlin-jvm-spring-3-webclient
-library: jvm-spring-restclient
+library: jvm-spring-webclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
diff --git a/bin/configs/kotlin-spring-cloud.yaml b/bin/configs/kotlin-spring-cloud.yaml
index 10e6f95a8057..676e15788e13 100644
--- a/bin/configs/kotlin-spring-cloud.yaml
+++ b/bin/configs/kotlin-spring-cloud.yaml
@@ -1,5 +1,5 @@
generatorName: kotlin-spring
-outputDir: samples/client/petstore/kotlin-spring-cloud
+outputDir: samples/server/petstore/kotlin-spring-cloud
library: spring-cloud
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
diff --git a/bin/configs/manual/rust-axum-header-uuid.yaml b/bin/configs/manual/rust-axum-header-uuid.yaml
new file mode 100644
index 000000000000..7e04339b464d
--- /dev/null
+++ b/bin/configs/manual/rust-axum-header-uuid.yaml
@@ -0,0 +1,9 @@
+generatorName: rust-axum
+outputDir: samples/server/petstore/rust-axum/output/rust-axum-header-uuid
+inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-axum/rust-axum-header-uuid.yaml
+templateDir: modules/openapi-generator/src/main/resources/rust-axum
+generateAliasAsModel: true
+additionalProperties:
+ hideGenerationTimestamp: "true"
+ packageName: rust-axum-header-uui
+enablePostProcessFile: true
diff --git a/bin/configs/manual/rust-axum-validation.yaml b/bin/configs/manual/rust-axum-validation.yaml
new file mode 100644
index 000000000000..3fd5ba01b5e6
--- /dev/null
+++ b/bin/configs/manual/rust-axum-validation.yaml
@@ -0,0 +1,10 @@
+generatorName: rust-axum
+outputDir: samples/server/petstore/rust-axum/output/rust-axum-validation-test
+inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/rust-axum-validation-test.yaml
+templateDir: modules/openapi-generator/src/main/resources/rust-axum
+generateAliasAsModel: true
+additionalProperties:
+ hideGenerationTimestamp: "true"
+ packageName: rust-axum-validation-test
+ disableValidator: "true"
+enablePostProcessFile: true
diff --git a/bin/configs/html2.yaml b/bin/configs/unmaintained/html2.yaml
similarity index 100%
rename from bin/configs/html2.yaml
rename to bin/configs/unmaintained/html2.yaml
diff --git a/docs/generators.md b/docs/generators.md
index 03c75077a3ac..16a044f8d86d 100644
--- a/docs/generators.md
+++ b/docs/generators.md
@@ -101,6 +101,7 @@ The following generators are available:
* [java-helidon-server (beta)](generators/java-helidon-server.md)
* [java-inflector](generators/java-inflector.md)
* [java-micronaut-server (beta)](generators/java-micronaut-server.md)
+* [java-microprofile](generators/java-microprofile.md)
* [java-msf4j](generators/java-msf4j.md)
* [java-pkmst](generators/java-pkmst.md)
* [java-play-framework](generators/java-play-framework.md)
diff --git a/docs/generators/cpp-pistache-server.md b/docs/generators/cpp-pistache-server.md
index 178a0f2bbe86..f35b6398eea6 100644
--- a/docs/generators/cpp-pistache-server.md
+++ b/docs/generators/cpp-pistache-server.md
@@ -28,7 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Imports |
| ---------- | ------- |
-|Object|#include "Object.h"|
|nlohmann::json|#include <nlohmann/json.hpp>|
|std::map|#include <map>|
|std::string|#include <string>|
diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md
new file mode 100644
index 000000000000..3251f7591706
--- /dev/null
+++ b/docs/generators/java-microprofile.md
@@ -0,0 +1,364 @@
+---
+title: Documentation for the java-microprofile Generator
+---
+
+## METADATA
+
+| Property | Value | Notes |
+| -------- | ----- | ----- |
+| generator name | java-microprofile | pass this to the generate command after -g |
+| generator stability | STABLE | |
+| generator type | SERVER | |
+| generator language | Java | |
+| generator default templating engine | mustache | |
+| helpTxt | Generates a microprofile server. | |
+
+## CONFIG OPTIONS
+These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
+
+| Option | Description | Values | Default |
+| ------ | ----------- | ------ | ------- |
+|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
+|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
+|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
+|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
+|annotationLibrary|Select the complementary documentation annotation library.|
**none** Do not annotate Model and Api with complementary annotations. **swagger1** Annotate Model and Api using the Swagger Annotations 1.x library. **swagger2** Annotate Model and Api using the Swagger Annotations 2.x library. |none|
+|apiPackage|package for generated api classes| |org.openapitools.client.api|
+|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
+|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client|
+|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
+|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename. If not provided, uses the version from the OpenAPI specification file. If that's also not present, uses the default value of the artifactVersion option.| |1.0.0|
+|asyncNative|If true, async handlers will be used, instead of the sync version| |false|
+|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
+|booleanGetterPrefix|Set booleanGetterPrefix| |get|
+|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
+|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
+|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
+|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
+|dateLibrary|Option. Date library to use|**joda** Joda (for legacy app only) **legacy** Legacy java.util.Date **java8-localdatetime** Java 8 using LocalDateTime (for legacy app only) **java8** Java 8 native JSR310 (preferred for jdk 1.8+) |java8|
+|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
+|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
+|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
+|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org|
+|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false|
+|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|**false** The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. **true** Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default. |true|
+|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
+|documentationProvider|Select the OpenAPI documentation provider.|**none** Do not publish an OpenAPI specification. **source** Publish the original input OpenAPI specification. |source|
+|dynamicOperations|Generate operations dynamically at runtime from an OAS| |false|
+|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|**false** No changes to the enum's are made, this is the default option. **true** With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case. |false|
+|errorObjectType|Error Object type. (This option is for okhttp-gson only)| |null|
+|generateBuilders|Whether to generate builders for models| |false|
+|generateClientAsBean|For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).| |false|
+|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
+|gradleProperties|Append additional Gradle properties to the gradle.properties file| |null|
+|groupId|groupId in generated pom.xml| |org.openapitools|
+|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
+|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
+|implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false|
+|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
+|invokerPackage|root package for generated code| |org.openapitools.client|
+|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|**true** The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. **false** The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. |true|
+|library|library template (sub-template) to use|**jersey2** HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x **jersey3** HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x **feign** HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.x **okhttp-gson** [DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. **retrofit2** HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x) **resttemplate** HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x **webclient** HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x **restclient** HTTP client: Spring RestClient 6.1. JSON processing: Jackson 2.9.x **resteasy** HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x **vertx** HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x **google-api-client** HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x **rest-assured** HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8 **native** HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+ **microprofile** HTTP client: Microprofile client 1.x. JSON processing: JSON-B or Jackson 2.9.x **apache-httpclient** HTTP client: Apache httpclient 5.x |okhttp-gson|
+|licenseName|The name of the license| |Unlicense|
+|licenseUrl|The URL of the license| |http://unlicense.org|
+|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
+|microprofileMutiny|Whether to use async types for microprofile (currently only Smallrye Mutiny is supported).| |null|
+|microprofileRestClientVersion|Version of MicroProfile Rest Client API.| |null|
+|modelPackage|package for generated models| |org.openapitools.client.model|
+|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
+|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false|
+|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
+|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
+|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
+|performBeanValidation|Perform BeanValidation| |false|
+|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
+|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
+|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
+|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
+|serializableModel|boolean - toggle "implements Serializable" for generated models| |false|
+|serializationLibrary|Serialization library, default depends on value of the option library|**jsonb** Use JSON-B as serialization library **jackson** Use Jackson as serialization library **gson** Use Gson as serialization library |null|
+|snapshotVersion|Uses a SNAPSHOT version.|**true** Use a SnapShot Version **false** Use a Release Version |null|
+|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
+|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
+|sourceFolder|source folder for generated code| |src/main/java|
+|supportStreaming|Support streaming endpoint (beta)| |false|
+|supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.| |false|
+|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
+|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries| |false|
+|useBeanValidation|Use BeanValidation API annotations| |false|
+|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
+|useGzipFeature|Send gzip-encoded requests| |false|
+|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
+|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
+|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
+|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|
+|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|
+|useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.| |false|
+|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
+|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
+|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile support this option.| |false|
+|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false|
+|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false|
+|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
+
+## SUPPORTED VENDOR EXTENSIONS
+
+| Extension name | Description | Applicable for | Default value |
+| -------------- | ----------- | -------------- | ------------- |
+|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
+|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array
+|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value
+|x-tags|Specify multiple swagger tags for operation|OPERATION|null
+|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
+|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
+|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
+|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|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
+
+
+## IMPORT MAPPING
+
+| Type/Alias | Imports |
+| ---------- | ------- |
+|Array|java.util.List|
+|ArrayList|java.util.ArrayList|
+|BigDecimal|java.math.BigDecimal|
+|Date|java.util.Date|
+|DateTime|org.joda.time.*|
+|File|java.io.File|
+|HashMap|java.util.HashMap|
+|LinkedHashSet|java.util.LinkedHashSet|
+|List|java.util.*|
+|LocalDate|org.joda.time.*|
+|LocalDateTime|org.joda.time.*|
+|LocalTime|org.joda.time.*|
+|Map|java.util.Map|
+|Set|java.util.*|
+|Timestamp|java.sql.Timestamp|
+|URI|java.net.URI|
+|UUID|java.util.UUID|
+
+
+## INSTANTIATION TYPES
+
+| Type/Alias | Instantiated By |
+| ---------- | --------------- |
+|array|ArrayList|
+|map|HashMap|
+|set|LinkedHashSet|
+
+
+## LANGUAGE PRIMITIVES
+
+
+Boolean
+Double
+Float
+Integer
+Long
+Object
+String
+boolean
+byte[]
+
+
+## RESERVED WORDS
+
+
+_
+abstract
+apiclient
+apiexception
+apiresponse
+assert
+boolean
+break
+byte
+case
+catch
+char
+class
+configuration
+const
+continue
+default
+do
+double
+else
+enum
+extends
+file
+final
+finally
+float
+for
+goto
+if
+implements
+import
+instanceof
+int
+interface
+list
+localdate
+localreturntype
+localtime
+localvaraccept
+localvaraccepts
+localvarauthnames
+localvarcollectionqueryparams
+localvarcontenttype
+localvarcontenttypes
+localvarcookieparams
+localvarformparams
+localvarheaderparams
+localvarpath
+localvarpostbody
+localvarqueryparams
+long
+native
+new
+null
+object
+offsetdatetime
+package
+private
+protected
+public
+return
+short
+static
+strictfp
+stringutil
+super
+switch
+synchronized
+this
+throw
+throws
+transient
+try
+void
+volatile
+while
+
+
+## FEATURE SET
+
+
+### Client Modification Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasePath|✓|ToolingExtension
+|Authorizations|✗|ToolingExtension
+|UserAgent|✗|ToolingExtension
+|MockServer|✗|ToolingExtension
+
+### Data Type Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Custom|✗|OAS2,OAS3
+|Int32|✓|OAS2,OAS3
+|Int64|✓|OAS2,OAS3
+|Float|✓|OAS2,OAS3
+|Double|✓|OAS2,OAS3
+|Decimal|✓|ToolingExtension
+|String|✓|OAS2,OAS3
+|Byte|✓|OAS2,OAS3
+|Binary|✓|OAS2,OAS3
+|Boolean|✓|OAS2,OAS3
+|Date|✓|OAS2,OAS3
+|DateTime|✓|OAS2,OAS3
+|Password|✓|OAS2,OAS3
+|File|✓|OAS2
+|Uuid|✗|
+|Array|✓|OAS2,OAS3
+|Null|✗|OAS3
+|AnyType|✗|OAS2,OAS3
+|Object|✓|OAS2,OAS3
+|Maps|✓|ToolingExtension
+|CollectionFormat|✓|OAS2
+|CollectionFormatMulti|✓|OAS2
+|Enum|✓|OAS2,OAS3
+|ArrayOfEnum|✓|ToolingExtension
+|ArrayOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
+|ArrayOfCollectionOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfEnum|✓|ToolingExtension
+|MapOfEnum|✓|ToolingExtension
+|MapOfModel|✓|ToolingExtension
+|MapOfCollectionOfPrimitives|✓|ToolingExtension
+|MapOfCollectionOfModel|✓|ToolingExtension
+|MapOfCollectionOfEnum|✓|ToolingExtension
+
+### Documentation Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Readme|✓|ToolingExtension
+|Model|✓|ToolingExtension
+|Api|✓|ToolingExtension
+
+### Global Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Host|✓|OAS2,OAS3
+|BasePath|✓|OAS2,OAS3
+|Info|✓|OAS2,OAS3
+|Schemes|✗|OAS2,OAS3
+|PartialSchemes|✓|OAS2,OAS3
+|Consumes|✓|OAS2
+|Produces|✓|OAS2
+|ExternalDocumentation|✓|OAS2,OAS3
+|Examples|✓|OAS2,OAS3
+|XMLStructureDefinitions|✗|OAS2,OAS3
+|MultiServer|✗|OAS3
+|ParameterizedServer|✓|OAS3
+|ParameterStyling|✗|OAS3
+|Callbacks|✗|OAS3
+|LinkObjects|✗|OAS3
+
+### Parameter Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Path|✓|OAS2,OAS3
+|Query|✓|OAS2,OAS3
+|Header|✓|OAS2,OAS3
+|Body|✓|OAS2
+|FormUnencoded|✓|OAS2
+|FormMultipart|✓|OAS2
+|Cookie|✓|OAS3
+
+### Schema Support Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Simple|✓|OAS2,OAS3
+|Composite|✓|OAS2,OAS3
+|Polymorphism|✗|OAS2,OAS3
+|Union|✗|OAS3
+|allOf|✗|OAS2,OAS3
+|anyOf|✗|OAS3
+|oneOf|✗|OAS3
+|not|✗|OAS3
+
+### Security Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasicAuth|✓|OAS2,OAS3
+|ApiKey|✓|OAS2,OAS3
+|OpenIDConnect|✗|OAS3
+|BearerToken|✓|OAS3
+|OAuth2_Implicit|✓|OAS2,OAS3
+|OAuth2_Password|✓|OAS2,OAS3
+|OAuth2_ClientCredentials|✓|OAS2,OAS3
+|OAuth2_AuthorizationCode|✓|OAS2,OAS3
+|SignatureAuth|✓|OAS3
+|AWSV4Signature|✓|ToolingExtension
+
+### Wire Format Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|JSON|✓|OAS2,OAS3
+|XML|✓|OAS2,OAS3
+|PROTOBUF|✗|ToolingExtension
+|Custom|✗|OAS2,OAS3
diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md
index 20a758ccf3fd..63a97cf5360c 100644
--- a/docs/generators/typescript-fetch.md
+++ b/docs/generators/typescript-fetch.md
@@ -25,6 +25,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|enumPropertyNamingReplaceSpecialChar|Set to true to replace '-' and '+' symbols with 'minus_' and 'plus_' in enum of type string| |false|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|**false** No changes to the enum's are made, this is the default option. **true** With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case. |false|
+|fileNaming|Naming convention for the output files: 'PascalCase', 'camelCase', 'kebab-case'.| |PascalCase|
|importFileExtension|File extension to use with relative imports. Set it to '.js' or '.mjs' when using [ESM](https://nodejs.org/api/esm.html).| ||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|**true** The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. **false** The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc
index fb74722df473..1dbc35ad84c2 100644
--- a/modules/openapi-generator-gradle-plugin/README.adoc
+++ b/modules/openapi-generator-gradle-plugin/README.adoc
@@ -545,9 +545,7 @@ openApiGenerate {
apiPackage.set("org.openapi.example.api")
invokerPackage.set("org.openapi.example.invoker")
modelPackage.set("org.openapi.example.model")
- configOptions.set([
- dateLibrary: "java8"
- ])
+ configOptions.put("dateLibrary", "java8")
}
----
diff --git a/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
index f398c33c4b08..20db9ad5c958 100644
--- a/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
+++ b/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml
index 3e84f3d2f731..e794d44cc1a9 100644
--- a/modules/openapi-generator-gradle-plugin/pom.xml
+++ b/modules/openapi-generator-gradle-plugin/pom.xml
@@ -17,8 +17,8 @@
true
- 7.6
- 7.3-20210825160000+0000
+ 7.6.4
+ 7.4.2
diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
index 068cdb2dc260..3994438e2292 100644
--- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
+++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskConfigurationCacheTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskConfigurationCacheTest.kt
index b1636e2b0aea..b9ec75eb4293 100644
--- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskConfigurationCacheTest.kt
+++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskConfigurationCacheTest.kt
@@ -20,7 +20,7 @@ class GenerateTaskConfigurationCacheTest : TestBase() {
}
@DataProvider(name = "gradle_version_provider")
- private fun gradleVersionProviderWithConfigurationCache(): Array> = arrayOf(arrayOf("8.1.1"), arrayOf("7.6"))
+ private fun gradleVersionProviderWithConfigurationCache(): Array> = arrayOf(arrayOf("8.7"), arrayOf("7.6.4"))
@DataProvider(name = "gradle_version_provider_without_cc")
private fun gradleVersionProviderWithoutConfigurationCache(): Array> = arrayOf(arrayOf("5.6.1"))
diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskFromCacheTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskFromCacheTest.kt
index 9f73e0e388a3..e66f6264578d 100644
--- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskFromCacheTest.kt
+++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskFromCacheTest.kt
@@ -22,7 +22,7 @@ class GenerateTaskFromCacheTest : TestBase() {
}
@DataProvider(name = "gradle_version_provider")
- private fun gradleVersionProvider(): Array> = arrayOf(arrayOf("8.1.1"), arrayOf("7.6"))
+ private fun gradleVersionProvider(): Array> = arrayOf(arrayOf("8.7"), arrayOf("7.6.4"))
// inputSpec tests
diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskUpToDateTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskUpToDateTest.kt
index 7cfe81fd2766..f8932c6bcc45 100644
--- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskUpToDateTest.kt
+++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskUpToDateTest.kt
@@ -9,7 +9,7 @@ import kotlin.test.assertEquals
class GenerateTaskUpToDateTest : TestBase() {
@DataProvider(name = "gradle_version_provider")
- private fun gradleVersionProvider(): Array> = arrayOf(arrayOf("8.1.1"), arrayOf("7.6"))
+ private fun gradleVersionProvider(): Array> = arrayOf(arrayOf("8.7"), arrayOf("7.6.4"))
// inputSpec tests
diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/ValidateTaskDslTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/ValidateTaskDslTest.kt
index aa80ed587f8e..c6687bd69a01 100644
--- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/ValidateTaskDslTest.kt
+++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/ValidateTaskDslTest.kt
@@ -17,8 +17,8 @@ class ValidateTaskDslTest : TestBase() {
@DataProvider(name = "gradle_version_provider")
fun gradleVersionProvider(): Array> = arrayOf(
arrayOf(null), // uses the version of Gradle used to build the plugin itself
- arrayOf("8.1.1"),
- arrayOf("7.6")
+ arrayOf("8.7"),
+ arrayOf("7.6.4")
)
private fun getGradleRunner(gradleVersion: String?): GradleRunner {
diff --git a/modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml b/modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
index fdc0d5272e05..ab59209425d3 100644
--- a/modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
+++ b/modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
@@ -19,7 +19,7 @@
0.2.1
2.7
1.0.0
- 4.13.2
+ 5.10.2
1.4
diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml
index 29d1eb27ccd6..708c506dff91 100644
--- a/modules/openapi-generator-maven-plugin/pom.xml
+++ b/modules/openapi-generator-maven-plugin/pom.xml
@@ -59,8 +59,8 @@
${project.version}
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
${junit.version}
test
diff --git a/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java b/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java
index 4881db21921b..89dc94c4300a 100644
--- a/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java
+++ b/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java
@@ -16,7 +16,7 @@
package org.openapitools.codegen.plugin;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.nio.file.Files;
diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml
index fee18406f0f7..548ccb826cfd 100644
--- a/modules/openapi-generator-online/pom.xml
+++ b/modules/openapi-generator-online/pom.xml
@@ -127,8 +127,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
${junit.version}
test
diff --git a/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java b/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java
index 8df33829c926..394f09ac844d 100644
--- a/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java
+++ b/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java
@@ -1,14 +1,14 @@
package org.openapitools.codegen.online.api;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.openapitools.codegen.online.model.ResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
-import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;
import static org.hamcrest.Matchers.hasItem;
@@ -18,7 +18,7 @@
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
-@RunWith(SpringRunner.class)
+@ExtendWith(SpringExtension.class)
@WebMvcTest(GenApiController.class)
public class GenApiControllerTest {
diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml
index dbb884301b74..bb96ecff0540 100644
--- a/modules/openapi-generator/pom.xml
+++ b/modules/openapi-generator/pom.xml
@@ -322,10 +322,16 @@
com.tngtech.archunit
- archunit-junit4
+ archunit-junit5
${archunit.version}
test
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit.version}
+ test
+
org.testng
testng
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
index f90cd3d35d71..578b86152e81 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
@@ -76,48 +76,48 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
*/
public boolean required;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor17.
+ * See JSON Schema Validation Spec, Section 6.2.2
*/
public String maximum;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor17
+ * See JSON Schema Validation Spec, Section 6.2.3
*/
public boolean exclusiveMaximum;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor21
+ * See JSON Schema Validation Spec, Section 6.2.4
*/
public String minimum;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor21
+ * See JSON Schema Validation Spec, Section 6.2.5
*/
public boolean exclusiveMinimum;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor26
+ * See JSON Schema Validation Spec, Section 6.3.1
*/
public Integer maxLength;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor29
+ * See JSON Schema Validation Spec, Section 6.3.2
*/
public Integer minLength;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor33
+ * See JSON Schema Validation Spec, Section 6.3.3
*/
public String pattern;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor42
+ * See JSON Schema Validation Spec, Section 6.4.1
*/
public Integer maxItems;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor45
+ * See JSON Schema Validation Spec, Section 6.4.2
*/
public Integer minItems;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor49
+ * See JSON Schema Validation Spec, Section 6.4.3
*/
public boolean uniqueItems;
private Boolean uniqueItemsBoolean;
/**
- * See http://json-schema.org/latest/json-schema-validation.html#anchor14
+ * See JSON Schema Validation Spec, Section 6.2.1
*/
public Number multipleOf;
private Integer maxProperties;
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
index 1c0ac8ec20b4..35f7ae259a5a 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
@@ -2492,10 +2492,10 @@ protected String getSingleSchemaType(Schema schema) {
private String getPrimitiveType(Schema schema) {
if (schema == null) {
throw new RuntimeException("schema cannot be null in getPrimitiveType");
- } else if (typeMapping.containsKey(schema.getType() + "+" + schema.getFormat())) {
+ } else if (typeMapping.containsKey(ModelUtils.getType(schema) + "+" + schema.getFormat())) {
// allows custom type_format mapping.
// use {type}+{format}
- return typeMapping.get(schema.getType() + "+" + schema.getFormat());
+ return typeMapping.get(ModelUtils.getType(schema) + "+" + schema.getFormat());
} else if (ModelUtils.isNullType(schema)) {
// The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x,
// though this tooling supports it.
@@ -2536,7 +2536,7 @@ private String getPrimitiveType(Schema schema) {
} else if (ModelUtils.isShortSchema(schema)) {// int32
return "integer";
} else {
- return schema.getType(); // integer
+ return ModelUtils.getType(schema); // integer
}
} else if (ModelUtils.isMapSchema(schema)) {
return "map";
@@ -2567,11 +2567,11 @@ private String getPrimitiveType(Schema schema) {
return "object";
} else if (ModelUtils.isAnyType(schema)) {
return "AnyType";
- } else if (StringUtils.isNotEmpty(schema.getType())) {
- if (!schemaMapping.containsKey(schema.getType())) {
- LOGGER.warn("Unknown type found in the schema: {}. To map it, please use the schema mapping option (e.g. --schema-mappings in CLI)", schema.getType());
+ } else if (StringUtils.isNotEmpty(ModelUtils.getType(schema))) {
+ if (!schemaMapping.containsKey(ModelUtils.getType(schema))) {
+ LOGGER.warn("Unknown type found in the schema: {}. To map it, please use the schema mapping option (e.g. --schema-mappings in CLI)", ModelUtils.getType(schema));
}
- return schema.getType();
+ return ModelUtils.getType(schema);
}
// The 'type' attribute has not been set in the OAS schema, which means the value
// can be an arbitrary type, e.g. integer, string, object, array, number...
@@ -4019,10 +4019,10 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo
property.name = toVarName(name);
property.baseName = name;
- if (p.getType() == null) {
+ if (ModelUtils.getType(p) == null) {
property.openApiType = getSchemaType(p);
} else {
- property.openApiType = p.getType();
+ property.openApiType = ModelUtils.getType(p);
}
property.nameInPascalCase = camelize(property.name);
property.nameInCamelCase = camelize(property.name, LOWERCASE_FIRST_LETTER);
@@ -7128,7 +7128,7 @@ public List fromRequestBodyToFormParameters(RequestBody body,
Schema original = null;
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 &&
- schema.getType() == null && schema.getTypes() == null) {
+ ModelUtils.getType(schema) == null) {
if (schema.getAllOf().get(0) instanceof Schema) {
original = schema;
schema = (Schema) schema.getAllOf().get(0);
@@ -7781,7 +7781,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S
Schema original = null;
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 &&
- schema.getType() == null && schema.getTypes() == null) {
+ ModelUtils.getType(schema) == null) {
if (schema.getAllOf().get(0) instanceof Schema) {
original = schema;
schema = (Schema) schema.getAllOf().get(0);
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
index d24fbcabb955..e6480bac8d3f 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
@@ -408,8 +408,14 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
}
if (operation.getParameters() != null) {
for (Parameter parameter : operation.getParameters()) {
+ if (StringUtils.isNotEmpty(parameter.get$ref())) {
+ parameter = ModelUtils.getReferencedParameter(openAPI, parameter);
+ }
String swaggerParameterName = parameter.getName();
String pythonParameterName = this.toParamName(swaggerParameterName);
+ if (swaggerParameterName == null) {
+ throw new RuntimeException("Please report the issue as the parameter name cannot be null: " + parameter);
+ }
if (!swaggerParameterName.equals(pythonParameterName)) {
LOGGER.warn(
"Parameter name '{}' is not consistent with Python variable names. It will be replaced by '{}'",
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java
index fe823fc600c6..92638aaec3c8 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java
@@ -18,7 +18,6 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.Operation;
-import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.servers.Server;
@@ -53,6 +52,27 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
protected final String PREFIX = "";
protected String helpersPackage = "";
+ /** OpenApi types that shouldn't have a namespace added with getTypeDeclaration() at generation time (for nlohmann::json) */
+ private final Set openAPITypesWithoutModelNamespace = new HashSet<>();
+
+ /** int32_t (for integer) */
+ private static final String INT32_T = "int32_t";
+
+ /** int64_t (for long) */
+ private static final String INT64_T = "int64_t";
+
+ /** nlohmann::json (for object, AnyType) */
+ private static final String NLOHMANN_JSON = "nlohmann::json";
+
+ /** std:string (for date, DateTime, string, file, binary, UUID, URI, ByteArray) */
+ private static final String STD_STRING = "std::string";
+
+ /** std:map (for map) */
+ private static final String STD_MAP = "std::map";
+
+ /** std:vector (for array, set) */
+ private static final String STD_VECTOR = "std::vector";
+
@Override
public CodegenType getTag() {
return CodegenType.SERVER;
@@ -117,33 +137,35 @@ public CppPistacheServerCodegen() {
setupSupportingFiles();
languageSpecificPrimitives = new HashSet<>(
- Arrays.asList("int", "char", "bool", "long", "float", "double", "int32_t", "int64_t"));
+ Arrays.asList("int", "char", "bool", "long", "float", "double", INT32_T, INT64_T));
typeMapping = new HashMap<>();
- typeMapping.put("date", "std::string");
- typeMapping.put("DateTime", "std::string");
- typeMapping.put("string", "std::string");
- typeMapping.put("integer", "int32_t");
- typeMapping.put("long", "int64_t");
+ typeMapping.put("date", STD_STRING);
+ typeMapping.put("DateTime", STD_STRING);
+ typeMapping.put("string", STD_STRING);
+ typeMapping.put("integer", INT32_T);
+ typeMapping.put("long", INT64_T);
typeMapping.put("boolean", "bool");
- typeMapping.put("array", "std::vector");
- typeMapping.put("map", "std::map");
- typeMapping.put("set", "std::vector");
- typeMapping.put("file", "std::string");
- typeMapping.put("object", "Object");
- typeMapping.put("binary", "std::string");
+ typeMapping.put("array", STD_VECTOR);
+ typeMapping.put("map", STD_MAP);
+ typeMapping.put("set", STD_VECTOR);
+ typeMapping.put("file", STD_STRING);
+ typeMapping.put("object", NLOHMANN_JSON);
+ typeMapping.put("binary", STD_STRING);
typeMapping.put("number", "double");
- typeMapping.put("UUID", "std::string");
- typeMapping.put("URI", "std::string");
- typeMapping.put("ByteArray", "std::string");
- typeMapping.put("AnyType", "nlohmann::json");
+ typeMapping.put("UUID", STD_STRING);
+ typeMapping.put("URI", STD_STRING);
+ typeMapping.put("ByteArray", STD_STRING);
+ typeMapping.put("AnyType", NLOHMANN_JSON);
super.importMapping = new HashMap<>();
- importMapping.put("std::vector", "#include ");
- importMapping.put("std::map", "#include ");
- importMapping.put("std::string", "#include ");
- importMapping.put("Object", "#include \"Object.h\"");
- importMapping.put("nlohmann::json", "#include ");
+ importMapping.put(STD_VECTOR, "#include ");
+ importMapping.put(STD_MAP, "#include ");
+ importMapping.put(STD_STRING, "#include ");
+ importMapping.put(NLOHMANN_JSON, "#include ");
+
+ // nlohmann:json doesn't belong to model package
+ this.openAPITypesWithoutModelNamespace.add(NLOHMANN_JSON);
}
private void setupSupportingFiles() {
@@ -202,8 +224,16 @@ private void setupModelTemplate() {
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public String toModelImport(String name) {
+ // Do not reattempt to add #include on an already solved #include
+ if (name.startsWith("#include")) {
+ return null;
+ }
+
if (importMapping.containsKey(name)) {
return importMapping.get(name);
} else {
@@ -214,20 +244,23 @@ public String toModelImport(String name) {
@Override
public CodegenModel fromModel(String name, Schema model) {
+ // Exchange import directives from core model with ours
CodegenModel codegenModel = super.fromModel(name, model);
Set oldImports = codegenModel.imports;
codegenModel.imports = new HashSet<>();
+
for (String imp : oldImports) {
String newImp = toModelImport(imp);
- if (!newImp.isEmpty()) {
+
+ if (newImp != null && !newImp.isEmpty()) {
codegenModel.imports.add(newImp);
}
}
if(!codegenModel.isEnum
&& codegenModel.anyOf.size()>1
- && codegenModel.anyOf.contains("std::string")
+ && codegenModel.anyOf.contains(STD_STRING)
&& !codegenModel.anyOf.contains("AnyType")
&& codegenModel.interfaces.size()==1
){
@@ -388,7 +421,7 @@ public String getTypeDeclaration(Schema p) {
Schema inner = ModelUtils.getAdditionalProperties(p);
return getSchemaType(p) + "";
} else if (ModelUtils.isByteArraySchema(p)) {
- return "std::string";
+ return STD_STRING;
}
if (ModelUtils.isStringSchema(p)
|| ModelUtils.isDateSchema(p)
@@ -397,8 +430,14 @@ public String getTypeDeclaration(Schema p) {
return toModelName(openAPIType);
}
- String namespace = (String)additionalProperties.get("modelNamespace");
- return namespace + "::" + openAPIType;
+ // Some types might not support namespace
+ if (this.openAPITypesWithoutModelNamespace.contains(openAPIType)) {
+ return openAPIType;
+ }
+ else {
+ String namespace = (String) additionalProperties.get("modelNamespace");
+ return namespace + "::" + openAPIType;
+ }
}
@Override
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
new file mode 100644
index 000000000000..df04653b8a6e
--- /dev/null
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicroprofileServerCodegen.java
@@ -0,0 +1,71 @@
+package org.openapitools.codegen.languages;
+
+import java.io.File;
+import java.util.List;
+
+import org.openapitools.codegen.CodegenOperation;
+import org.openapitools.codegen.CodegenResponse;
+import org.openapitools.codegen.CodegenType;
+import org.openapitools.codegen.model.ModelMap;
+import org.openapitools.codegen.model.OperationMap;
+import org.openapitools.codegen.model.OperationsMap;
+
+public class JavaMicroprofileServerCodegen extends JavaClientCodegen {
+ public static final String PROJECT_NAME = "projectName";
+ public static final String MICROPROFILE_SERVER = "microprofileServer";
+ protected boolean microprofileServer = true;
+
+ public JavaMicroprofileServerCodegen() {
+ super();
+
+ outputFolder = "generated-code" + File.separator + "microprofile";
+ invokerPackage = "org.openapitools.server";
+ artifactId = "openapi-microprofile-server";
+ apiPackage = "org.openapitools.server.api";
+ modelPackage = "org.openapitools.server.model";
+ setLibrary("microprofile");
+ }
+
+ public CodegenType getTag() {
+ return CodegenType.SERVER;
+ }
+
+ public String getName() {
+ return "java-microprofile";
+ }
+
+ public String getHelp() {
+ return "Generates a microprofile server.";
+ }
+ @Override
+ public void processOpts() {
+ super.processOpts();
+ additionalProperties.put(MICROPROFILE_SERVER, microprofileServer);
+ }
+
+ @Override
+ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) {
+ super.postProcessOperationsWithModels(objs, allModels);
+ OperationMap operations = objs.getOperations();
+ if (operations != null) {
+ List ops = operations.getOperation();
+ for (CodegenOperation operation : ops) {
+ List responses = operation.responses;
+ if (multiple2xxResponsesSpecified(responses)) {
+ operation.vendorExtensions.put("x-multiple-2xx-response-operation", true);
+ }
+ }
+ }
+ return objs;
+ }
+
+ private boolean multiple2xxResponsesSpecified(List responses) {
+ int responseIs2xxCount = 0;
+ for (CodegenResponse response : responses) {
+ if (response.is2xx) {
+ responseIs2xxCount++;
+ }
+ }
+ return responseIs2xxCount > 1;
+ }
+}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpFlightServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpFlightServerCodegen.java
index d6155803e0ee..f7248ac77a28 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpFlightServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpFlightServerCodegen.java
@@ -34,6 +34,7 @@
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenProperty;
+import org.openapitools.codegen.CodegenResponse;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.meta.GeneratorMetadata;
@@ -202,11 +203,14 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List operationList = operations.getOperation();
operationList.forEach(operation -> {
operation.vendorExtensions.put("x-path", mapToFlightPath(operation.path));
- String returnType = operation.responses.stream().filter(r -> r.is2xx && r.dataType != null).map(r -> this.getTypeHint(r.dataType, false, false)).filter(t -> !t.isEmpty()).map(t -> t + "|null").findFirst().orElse("void");
+ CodegenResponse defaultResponse = operation.responses.stream().filter(r -> r.is2xx && r.dataType != null && !this.getTypeHint(r.dataType, false, false).isEmpty()).findFirst().orElse(null);
+ String returnType = defaultResponse != null ? this.getTypeHint(defaultResponse.dataType, false, false) + "|null" : "void";
operation.vendorExtensions.put("x-return-type", returnType);
operation.vendorExtensions.put("x-return-type-is-void", returnType.equals("void"));
- operation.vendorExtensions.put("x-return-type-comment",
- operation.responses.stream().filter(r -> r.is2xx && r.dataType != null).map(r -> this.getTypeHint(r.dataType, true, false)).filter(t -> !t.isEmpty()).map(t -> t + "|null").findFirst().orElse("void"));
+ operation.vendorExtensions.put("x-return-type-comment", defaultResponse != null ? this.getTypeHint(defaultResponse.dataType, true, false) + "|null" : "void");
+ operation.vendorExtensions.put("x-default-media-type", defaultResponse != null ? (
+ defaultResponse.getContent().containsKey("application/json") ? "application/json" : defaultResponse.getContent().keySet().stream().findFirst().orElse(null)) : null);
+ operation.vendorExtensions.put("x-default-status-code", defaultResponse != null ? defaultResponse.code : operation.responses.stream().filter(r -> !r.isDefault).findFirst().map(r -> r.code).orElse("200"));
operation.vendorExtensions.put("x-nonFormParams", operation.allParams.stream().filter(p -> !p.isFormParam).toArray());
operation.allParams.forEach(param -> {
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java
index 1efb600d2785..7767de8b6234 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java
@@ -45,6 +45,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.ObjectInputFilter.Config;
import java.math.BigInteger;
import java.nio.file.Path;
import java.util.*;
@@ -552,6 +553,12 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
}
}
+ // Include renderUuidConversionImpl exactly once in the vendorExtensions map when
+ // at least one `uuid::Uuid` converted from a header value in the resulting Rust code.
+ final Boolean renderUuidConversionImpl = op.headerParams.stream().anyMatch(h -> h.getDataType().equals(uuidType));
+ if (renderUuidConversionImpl) {
+ additionalProperties.put("renderUuidConversionImpl", "true");
+ }
return op;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java
index 6bc75f0e6390..e6e49222e2b2 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java
@@ -26,7 +26,6 @@
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.parser.util.SchemaTypeUtil;
-import java.util.stream.Collectors;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.meta.features.SecurityFeature;
@@ -38,6 +37,10 @@
import java.io.File;
import java.util.*;
+import java.util.stream.Collectors;
+
+import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
+import static org.openapitools.codegen.utils.StringUtils.*;
public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodegen {
public static final String NPM_REPOSITORY = "npmRepository";
@@ -49,6 +52,10 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values.";
public static final String IMPORT_FILE_EXTENSION_SWITCH = "importFileExtension";
public static final String IMPORT_FILE_EXTENSION_SWITCH_DESC = "File extension to use with relative imports. Set it to '.js' or '.mjs' when using [ESM](https://nodejs.org/api/esm.html).";
+ public static final String FILE_NAMING = "fileNaming";
+ public static final String KEBAB_CASE = "kebab-case";
+ public static final String CAMEL_CASE = "camelCase";
+ public static final String PASCAL_CASE = "PascalCase";
protected String npmRepository = null;
protected String importFileExtension = "";
@@ -58,6 +65,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
protected boolean addedModelIndex = false;
protected boolean withoutRuntimeChecks = false;
protected boolean stringEnums = false;
+ protected String fileNaming = PASCAL_CASE;
// "Saga and Record" mode.
public static final String SAGAS_AND_RECORDS = "sagasAndRecords";
@@ -105,6 +113,33 @@ public TypeScriptFetchClientCodegen() {
this.cliOptions.add(new CliOption(SAGAS_AND_RECORDS, "Setting this property to true will generate additional files for use with redux-saga and immutablejs.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(STRING_ENUMS, STRING_ENUMS_DESC, SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(IMPORT_FILE_EXTENSION_SWITCH, IMPORT_FILE_EXTENSION_SWITCH_DESC).defaultValue(""));
+ this.cliOptions.add(new CliOption(FILE_NAMING, "Naming convention for the output files: 'PascalCase', 'camelCase', 'kebab-case'.").defaultValue(this.fileNaming));
+ }
+
+ @Override
+ public String toApiFilename(String name) {
+ return convertUsingFileNamingConvention(super.toApiFilename(name));
+ }
+
+ @Override
+ public String toModelFilename(String name) {
+ return convertUsingFileNamingConvention(super.toModelFilename(name));
+ }
+
+ /**
+ * Converts the original name according to the current fileNaming
strategy.
+ *
+ * @param originalName the original name to transform
+ * @return the transformed name
+ */
+ private String convertUsingFileNamingConvention(String originalName) {
+ String name = originalName;
+ if (KEBAB_CASE.equals(fileNaming)) {
+ name = dashize(underscore(name));
+ } else if (CAMEL_CASE.equals(fileNaming)) {
+ name = camelize(name, LOWERCASE_FIRST_LETTER);
+ }
+ return name;
}
@Override
@@ -148,6 +183,20 @@ public void setStringEnums(Boolean stringEnums) {
this.stringEnums = stringEnums;
}
+ /**
+ * Set the file naming type.
+ *
+ * @param fileNaming the file naming to use
+ */
+ public void setFileNaming(String fileNaming) {
+ if (PASCAL_CASE.equals(fileNaming) || CAMEL_CASE.equals(fileNaming) || KEBAB_CASE.equals(fileNaming)) {
+ this.fileNaming = fileNaming;
+ } else {
+ throw new IllegalArgumentException("Invalid file naming '" +
+ fileNaming + "'. Must be 'PascalCase', 'camelCase' or 'kebab-case'");
+ }
+ }
+
public Boolean getSagasAndRecords() {
return sagasAndRecords;
}
@@ -250,6 +299,10 @@ public void processOpts() {
this.setStringEnums(convertPropertyToBoolean(STRING_ENUMS));
}
+ if (additionalProperties.containsKey(FILE_NAMING)) {
+ this.setFileNaming(additionalProperties.get(FILE_NAMING).toString());
+ }
+
if (!withoutRuntimeChecks) {
this.modelTemplateFiles.put("models.mustache", ".ts");
typeMapping.put("date", "Date");
@@ -367,7 +420,7 @@ public Map postProcessAllModels(Map objs)
for (ModelMap model : entry.getModels()) {
ExtendedCodegenModel codegenModel = (ExtendedCodegenModel) model.getModel();
model.put("hasImports", codegenModel.imports.size() > 0);
-
+ model.put("tsImports", toTsImports(codegenModel, parseImports(codegenModel)));
allModels.add(codegenModel);
if (codegenModel.isEntity) {
entityModelClassnames.add(codegenModel.classname);
@@ -401,6 +454,38 @@ public Map postProcessAllModels(Map objs)
return result;
}
+ /**
+ * Parse imports
+ */
+ private Set parseImports(CodegenModel cm) {
+ Set newImports = new HashSet<>();
+ if (cm.imports.size() > 0) {
+ for (String name : cm.imports) {
+ if (name.indexOf(" | ") >= 0) {
+ String[] parts = name.split(" \\| ");
+ Collections.addAll(newImports, parts);
+ } else {
+ newImports.add(name);
+ }
+ }
+ }
+ return newImports;
+ }
+
+ private List> toTsImports(CodegenModel cm, Set imports) {
+ List> tsImports = new ArrayList<>();
+ for (String im : imports) {
+ if (!im.equals(cm.classname)) {
+ HashMap tsImport = new HashMap<>();
+ // TVG: This is used as class name in the import statements of the model file
+ tsImport.put("classname", im);
+ tsImport.put("filename", toModelFilename(im));
+ tsImports.add(tsImport);
+ }
+ }
+ return tsImports;
+ }
+
private void autoSetDefaultValueForProperty(ExtendedCodegenProperty var) {
if (var.isArray || var.isModel) {
var.defaultValue = var.dataTypeAlternate + "()";
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java
index bbaf74bf4245..5a0e3c4b2f7e 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java
@@ -419,16 +419,7 @@ public static String getSimpleRef(String ref) {
* @return true if the specified schema is an Object schema.
*/
public static boolean isTypeObjectSchema(Schema schema) {
- if (schema instanceof JsonSchema) { // 3.1 spec
- if (schema.getTypes() != null && schema.getTypes().size() == 1) {
- return SchemaTypeUtil.OBJECT_TYPE.equals(schema.getTypes().iterator().next());
- } else {
- // null type or multiple types, e.g. [string, integer]
- return false;
- }
- } else { // 3.0.x or 2.0 spec
- return SchemaTypeUtil.OBJECT_TYPE.equals(schema.getType());
- }
+ return SchemaTypeUtil.OBJECT_TYPE.equals(getType(schema));
}
/**
@@ -460,9 +451,9 @@ public static boolean isObjectSchema(Schema schema) {
return (schema instanceof ObjectSchema) ||
// must not be a map
- (SchemaTypeUtil.OBJECT_TYPE.equals(schema.getType()) && !(ModelUtils.isMapSchema(schema))) ||
+ (SchemaTypeUtil.OBJECT_TYPE.equals(getType(schema)) && !(ModelUtils.isMapSchema(schema))) ||
// must have at least one property
- (schema.getType() == null && schema.getProperties() != null && !schema.getProperties().isEmpty());
+ (getType(schema) == null && schema.getProperties() != null && !schema.getProperties().isEmpty());
}
/**
@@ -594,17 +585,7 @@ public static boolean isArraySchema(Schema schema) {
if (schema == null) {
return false;
}
-
- if (schema instanceof JsonSchema) { // 3.1 spec
- if (schema.getTypes() != null && schema.getTypes().contains("array")) {
- return true;
- } else {
- return false;
- }
- } else { // 3.0 spec
- return (schema instanceof ArraySchema) || "array".equals(schema.getType());
- }
-
+ return (schema instanceof ArraySchema) || "array".equals(getType(schema));
}
/**
@@ -636,89 +617,89 @@ public static boolean isSet(Schema schema) {
}
public static boolean isStringSchema(Schema schema) {
- return schema instanceof StringSchema || SchemaTypeUtil.STRING_TYPE.equals(schema.getType());
+ return schema instanceof StringSchema || SchemaTypeUtil.STRING_TYPE.equals(getType(schema));
}
public static boolean isIntegerSchema(Schema schema) {
- return schema instanceof IntegerSchema || SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType());
+ return schema instanceof IntegerSchema || SchemaTypeUtil.INTEGER_TYPE.equals(getType(schema));
}
public static boolean isShortSchema(Schema schema) {
// format: short (int32)
- return SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType()) // type: integer
+ return SchemaTypeUtil.INTEGER_TYPE.equals(getType(schema)) // type: integer
&& SchemaTypeUtil.INTEGER32_FORMAT.equals(schema.getFormat());
}
public static boolean isUnsignedIntegerSchema(Schema schema) {
- return SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType()) && // type: integer
+ return SchemaTypeUtil.INTEGER_TYPE.equals(getType(schema)) && // type: integer
("int32".equals(schema.getFormat()) || schema.getFormat() == null) && // format: int32
(schema.getExtensions() != null && (Boolean) schema.getExtensions().getOrDefault("x-unsigned", Boolean.FALSE));
}
public static boolean isLongSchema(Schema schema) {
// format: long (int64)
- return SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType()) // type: integer
+ return SchemaTypeUtil.INTEGER_TYPE.equals(getType(schema)) // type: integer
&& SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat());
}
public static boolean isUnsignedLongSchema(Schema schema) {
- return SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType()) && // type: integer
+ return SchemaTypeUtil.INTEGER_TYPE.equals(getType(schema)) && // type: integer
"int64".equals(schema.getFormat()) && // format: int64
(schema.getExtensions() != null && (Boolean) schema.getExtensions().getOrDefault("x-unsigned", Boolean.FALSE));
}
public static boolean isBooleanSchema(Schema schema) {
- return schema instanceof BooleanSchema || SchemaTypeUtil.BOOLEAN_TYPE.equals(schema.getType());
+ return schema instanceof BooleanSchema || SchemaTypeUtil.BOOLEAN_TYPE.equals(getType(schema));
}
public static boolean isNumberSchema(Schema schema) {
- return schema instanceof NumberSchema || SchemaTypeUtil.NUMBER_TYPE.equals(schema.getType());
+ return schema instanceof NumberSchema || SchemaTypeUtil.NUMBER_TYPE.equals(getType(schema));
}
public static boolean isFloatSchema(Schema schema) {
// format: float
- return SchemaTypeUtil.NUMBER_TYPE.equals(schema.getType())
+ return SchemaTypeUtil.NUMBER_TYPE.equals(getType(schema))
&& SchemaTypeUtil.FLOAT_FORMAT.equals(schema.getFormat());
}
public static boolean isDoubleSchema(Schema schema) {
// format: double
- return SchemaTypeUtil.NUMBER_TYPE.equals(schema.getType())
+ return SchemaTypeUtil.NUMBER_TYPE.equals(getType(schema))
&& SchemaTypeUtil.DOUBLE_FORMAT.equals(schema.getFormat());
}
public static boolean isDateSchema(Schema schema) {
return (schema instanceof DateSchema) ||
// format: date
- (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
+ (SchemaTypeUtil.STRING_TYPE.equals(getType(schema))
&& SchemaTypeUtil.DATE_FORMAT.equals(schema.getFormat()));
}
public static boolean isDateTimeSchema(Schema schema) {
return (schema instanceof DateTimeSchema) ||
// format: date-time
- (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
+ (SchemaTypeUtil.STRING_TYPE.equals(getType(schema))
&& SchemaTypeUtil.DATE_TIME_FORMAT.equals(schema.getFormat()));
}
public static boolean isPasswordSchema(Schema schema) {
return (schema instanceof PasswordSchema) ||
// double
- (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
+ (SchemaTypeUtil.STRING_TYPE.equals(getType(schema))
&& SchemaTypeUtil.PASSWORD_FORMAT.equals(schema.getFormat()));
}
public static boolean isByteArraySchema(Schema schema) {
return (schema instanceof ByteArraySchema) ||
// format: byte
- (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
+ (SchemaTypeUtil.STRING_TYPE.equals(getType(schema))
&& SchemaTypeUtil.BYTE_FORMAT.equals(schema.getFormat()));
}
public static boolean isBinarySchema(Schema schema) {
return (schema instanceof BinarySchema) ||
// format: binary
- (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
+ (SchemaTypeUtil.STRING_TYPE.equals(getType(schema))
&& SchemaTypeUtil.BINARY_FORMAT.equals(schema.getFormat()));
}
@@ -731,26 +712,26 @@ public static boolean isFileSchema(Schema schema) {
public static boolean isUUIDSchema(Schema schema) {
return (schema instanceof UUIDSchema) ||
// format: uuid
- (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
+ (SchemaTypeUtil.STRING_TYPE.equals(getType(schema))
&& SchemaTypeUtil.UUID_FORMAT.equals(schema.getFormat()));
}
public static boolean isURISchema(Schema schema) {
// format: uri
- return SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
+ return SchemaTypeUtil.STRING_TYPE.equals(getType(schema))
&& URI_FORMAT.equals(schema.getFormat());
}
public static boolean isEmailSchema(Schema schema) {
return (schema instanceof EmailSchema) ||
// format: email
- (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
+ (SchemaTypeUtil.STRING_TYPE.equals(getType(schema))
&& SchemaTypeUtil.EMAIL_FORMAT.equals(schema.getFormat()));
}
public static boolean isDecimalSchema(Schema schema) {
// format: number
- return SchemaTypeUtil.STRING_TYPE.equals(schema.getType()) // type: string
+ return SchemaTypeUtil.STRING_TYPE.equals(getType(schema)) // type: string
&& "number".equals(schema.getFormat());
}
@@ -898,7 +879,7 @@ public static boolean isFreeFormObject(Schema schema) {
}
// has at least one property
- if ("object".equals(schema.getType())) {
+ if ("object".equals(getType(schema))) {
// no properties
if ((schema.getProperties() == null || schema.getProperties().isEmpty())) {
Schema addlProps = ModelUtils.getAdditionalProperties(schema);
@@ -1782,7 +1763,7 @@ public static boolean isNullableComposedSchema(Schema schema) {
* @return true if the schema is the 'null' type
*/
public static boolean isNullType(Schema schema) {
- return "null".equals(schema.getType());
+ return "null".equals(getType(schema));
}
/**
@@ -1798,7 +1779,7 @@ public static boolean isAnyType(Schema schema) {
// TODO remove the ref check here, or pass in the spec version
// openapi 3.1.0 specs allow ref to be adjacent to any keyword
// openapi 3.0.3 and earlier do not allow adjacent keywords to refs
- return (schema.get$ref() == null && schema.getType() == null);
+ return (schema.get$ref() == null && getType(schema) == null);
}
public static void syncValidationProperties(Schema schema, IJsonSchemaValidationProperties target) {
@@ -1930,7 +1911,7 @@ private static void setNumericValidations(Schema schema, BigDecimal multipleOf,
private static void logWarnMessagesForIneffectiveValidations(Set setValidations, Schema schema, Set effectiveValidations) {
setValidations.removeAll(effectiveValidations);
setValidations.stream().forEach(validation -> {
- LOGGER.warn("Validation '" + validation + "' has no effect on schema '" + schema.getType() +"'. Ignoring!");
+ LOGGER.warn("Validation '" + validation + "' has no effect on schema '" + getType(schema) +"'. Ignoring!");
});
}
@@ -2139,7 +2120,11 @@ public static String getType(Schema schema) {
}
if (schema instanceof JsonSchema) {
- return String.valueOf(schema.getTypes().iterator().next());
+ if (schema.getTypes() != null) {
+ return String.valueOf(schema.getTypes().iterator().next());
+ } else {
+ return null;
+ }
} else {
return schema.getType();
}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/api_test.mustache
index 0281b4d80ced..15e1beb6f8c3 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/api_test.mustache
@@ -5,9 +5,9 @@ package {{package}};
import {{invokerPackage}}.ApiException;
{{#imports}}import {{import}};
{{/imports}}
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -19,7 +19,7 @@ import java.util.Map;
/**
* API tests for {{classname}}
*/
-@Ignore
+@Disabled
public class {{classname}}Test {
private final {{classname}} api = new {{classname}}();
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/pom.mustache
index 1b6aa820d29a..08da4d4abe8a 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/pom.mustache
@@ -80,7 +80,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.0.0-M7
+ 3.2.5
@@ -91,7 +91,6 @@
-Xms512m -Xmx1500m
methods
10
- pertest
@@ -337,8 +336,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
${junit-version}
test
@@ -366,6 +365,6 @@
{{#useBeanValidation}}
3.0.2
{{/useBeanValidation}}
- 4.13.2
+ 5.10.2
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/README.mustache
index 58d2d5f5c18c..377dfc2c9100 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/README.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/README.mustache
@@ -1,10 +1,19 @@
-# {{appName}} - MicroProfile Rest Client
+# {{appName}} - MicroProfile Rest Client & MicroProfile Server
{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}
+{{^microprofileServer}}
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
[MicroProfile Rest Client](https://github.com/eclipse/microprofile-rest-client) is a type-safe way of calling
REST services. The generated client contains an interface which acts as the client, you can inject it into dependent classes.
+{{/microprofileServer}}
+
+{{#microprofileServer}}
+## Overview
+This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
+The generated server contains an interface which acts as the server, you can inject it into the controller class.
+This module is intended to provide additional server features, like accessing an operations response object, when multiple responses where specified.
+{{/microprofileServer}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache
index 91eab8c6e0be..6e25c1f10127 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache
@@ -38,7 +38,9 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
*/
{{/appName}}
-@RegisterRestClient{{#configKey}}(configKey="{{configKey}}"){{/configKey}}
+{{^microprofileServer}}
+@RegisterRestClient{{#configKey}}(configKey="{{configKey}}"){{/configKey}}{{#configKeyFromClassName}}{{#operations}}(configKey="{{configKey}}"){{/operations}}{{/configKeyFromClassName}}
+{{/microprofileServer}}
@RegisterProvider(ApiExceptionMapper.class)
@Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}")
public interface {{classname}} {
@@ -70,7 +72,7 @@ public interface {{classname}} {
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} })
{{/hasProduces}}
{{^useSingleRequestParameter}}
- {{^vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}}{{#vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni{{/microprofileMutiny}}{{^microprofileMutiny}}void{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException, ProcessingException;
+ {{^vendorExtensions.x-java-is-response-void}}{{#microprofileServer}}{{> server_operation}}{{/microprofileServer}}{{^microprofileServer}}{{> client_operation}}{{/microprofileServer}}{{/vendorExtensions.x-java-is-response-void}}{{#vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni{{/microprofileMutiny}}{{^microprofileMutiny}}void{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException, ProcessingException;
{{/useSingleRequestParameter}}
{{#useSingleRequestParameter}}
{{^vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}}{{#vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni{{/microprofileMutiny}}{{^microprofileMutiny}}void{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}} {{nickname}}({{#hasNonBodyParams}}@BeanParam {{operationIdCamelCase}}Request request{{/hasNonBodyParams}}{{#bodyParams}}{{#hasNonBodyParams}}, {{/hasNonBodyParams}}{{>bodyParams}}{{/bodyParams}}) throws ApiException, ProcessingException;
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/client_operation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/client_operation.mustache
new file mode 100644
index 000000000000..403918ddc70b
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/client_operation.mustache
@@ -0,0 +1 @@
+{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache
index f9f13cac22f8..870bf32c1ca0 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojo.mustache
@@ -170,4 +170,4 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
}
return o.toString().replace("\n", "\n ");
}
-}
\ No newline at end of file
+}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/server_operation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/server_operation.mustache
new file mode 100644
index 000000000000..d6fa9054d4d4
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/server_operation.mustache
@@ -0,0 +1 @@
+{{#vendorExtensions.x-multiple-2xx-response-operation}}{{#microprofileMutiny}}Uni{{/microprofileMutiny}}{{^microprofileMutiny}}Response{{/microprofileMutiny}}{{/vendorExtensions.x-multiple-2xx-response-operation}}{{^vendorExtensions.x-multiple-2xx-response-operation}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}}{{/vendorExtensions.x-multiple-2xx-response-operation}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache
index 5bcfd364feef..3610bdc22052 100644
--- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache
+++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache
@@ -110,9 +110,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
return this;
}
- public {{classname}} remove{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
- if ({{name}}Item != null && this.{{name}} != null) {
- this.{{name}}.remove({{name}}Item);
+ public {{classname}} remove{{nameInPascalCase}}Item(String key) {
+ if (this.{{name}} != null) {
+ this.{{name}}.remove(key);
}
return this;
diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache
index 65a46053d534..f44c6083fdd3 100644
--- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache
@@ -162,7 +162,14 @@
${beanvalidation-version}
provided
-{{/useBeanValidation}}
+ {{/useBeanValidation}}
+ {{#openApiNullable}}
+
+ org.openapitools
+ jackson-databind-nullable
+ ${jackson-databind-nullable-version}
+
+ {{/openApiNullable}}
1.8
@@ -192,5 +199,8 @@
{{^useJakartaEe}}
2.1.6
{{/useJakartaEe}}
+{{#openApiNullable}}
+ 0.2.6
+{{/openApiNullable}}
diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
index 3521954fc48b..8fae8fb9b968 100644
--- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
+++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
@@ -80,6 +80,7 @@ org.openapitools.codegen.languages.JuliaServerCodegen
org.openapitools.codegen.languages.K6ClientCodegen
org.openapitools.codegen.languages.LuaClientCodegen
org.openapitools.codegen.languages.MarkdownDocumentationCodegen
+org.openapitools.codegen.languages.JavaMicroprofileServerCodegen
org.openapitools.codegen.languages.MysqlSchemaCodegen
org.openapitools.codegen.languages.N4jsClientCodegen
org.openapitools.codegen.languages.NimClientCodegen
diff --git a/modules/openapi-generator/src/main/resources/codegen/generatorClassTest.mustache b/modules/openapi-generator/src/main/resources/codegen/generatorClassTest.mustache
index d4773b14f813..adc71b7f0bd8 100644
--- a/modules/openapi-generator/src/main/resources/codegen/generatorClassTest.mustache
+++ b/modules/openapi-generator/src/main/resources/codegen/generatorClassTest.mustache
@@ -1,6 +1,6 @@
package {{generatorPackage}};
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.config.CodegenConfigurator;
diff --git a/modules/openapi-generator/src/main/resources/codegen/pom.mustache b/modules/openapi-generator/src/main/resources/codegen/pom.mustache
index 144e81a08eb4..81a80f9df176 100644
--- a/modules/openapi-generator/src/main/resources/codegen/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/codegen/pom.mustache
@@ -31,7 +31,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.12
+ 2.22.2
@@ -41,7 +41,6 @@
-Xms512m -Xmx1500m
methods
- pertest
@@ -114,15 +113,16 @@
provided
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
${junit-version}
+ test
UTF-8
{{openapiGeneratorVersion}}
1.0.0
- 4.13.2
+ 5.10.2
diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache
index ac016229aee6..ae6f06a4cf43 100644
--- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache
@@ -61,7 +61,7 @@ bool {{classname}}::validate(std::stringstream& msg, const std::string& pathPref
{{> model-validation-body }}
}
{{/hasValidation}}{{#required}}{{#isModel}}
- if (!m_{{name}}.validate()) {
+ if (!m_{{name}}.validate(msg, _pathPrefix + ".{{nameInCamelCase}}")) {
msg << _pathPrefix << ": {{name}} is invalid;";
success = false;
}{{/isModel}}{{/required}}{{/isArray}}{{/vars}}{{/isEnum}}{{#vendorExtensions.x-is-string-enum-container}}{{#anyOf}}{{#-first}}
diff --git a/modules/openapi-generator/src/main/resources/go-server/controller-api.mustache b/modules/openapi-generator/src/main/resources/go-server/controller-api.mustache
index 00bebd2124fa..5dc6fd9aebd1 100644
--- a/modules/openapi-generator/src/main/resources/go-server/controller-api.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/controller-api.mustache
@@ -47,7 +47,7 @@ func With{{classname}}ErrorHandler(h ErrorHandler) {{classname}}Option {
}
// New{{classname}}Controller creates a default api controller
-func New{{classname}}Controller(s {{classname}}Servicer, opts ...{{classname}}Option) Router {
+func New{{classname}}Controller(s {{classname}}Servicer, opts ...{{classname}}Option) *{{classname}}Controller {
controller := &{{classname}}Controller{
service: s,
errorHandler: DefaultErrorHandler,
@@ -520,7 +520,7 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
{{/required}}
{{^required}}
{{#defaultValue}}
- param := {{^isString}}{{dataType}}({{/isString}}{{defaultValue}}{{^isString}}){{/isString}}
+ param := {{^isString}}{{dataType}}({{/isString}}"{{defaultValue}}"{{^isString}}){{/isString}}
{{paramName}}Param = {{#isNullable}}&{{/isNullable}}param
{{/defaultValue}}
{{/required}}
@@ -631,5 +631,5 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
return
}
// If no error, encode the body and the result code
- EncodeJSONResponse(result.Body, &result.Code,{{#addResponseHeaders}} result.Headers,{{/addResponseHeaders}} w)
+ _ = EncodeJSONResponse(result.Body, &result.Code,{{#addResponseHeaders}} result.Headers,{{/addResponseHeaders}} w)
}{{/operation}}{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/go-server/error.mustache b/modules/openapi-generator/src/main/resources/go-server/error.mustache
index f14e61986119..4c90a3b9f253 100644
--- a/modules/openapi-generator/src/main/resources/go-server/error.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/error.mustache
@@ -25,9 +25,9 @@ func (e *ParsingError) Unwrap() error {
func (e *ParsingError) Error() string {
if e.Param == "" {
return e.Err.Error()
- } else {
- return e.Param + ": " + e.Err.Error()
}
+
+ return e.Param + ": " + e.Err.Error()
}
// RequiredError indicates that an error has occurred when parsing request parameters
@@ -45,15 +45,21 @@ type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result
// DefaultErrorHandler defines the default logic on how to handle errors from the controller. Any errors from parsing
// request params will return a StatusBadRequest. Otherwise, the error code originating from the servicer will be used.
-func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse) {
- if _, ok := err.(*ParsingError); ok {
+func DefaultErrorHandler(w http.ResponseWriter, _ *http.Request, err error, result *ImplResponse) {
+ var parsingErr *ParsingError
+ if ok := errors.As(err, &parsingErr); ok {
// Handle parsing errors
- EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest),{{#addResponseHeaders}} map[string][]string{},{{/addResponseHeaders}} w)
- } else if _, ok := err.(*RequiredError); ok {
- // Handle missing required errors
- EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity),{{#addResponseHeaders}} map[string][]string{},{{/addResponseHeaders}} w)
- } else {
- // Handle all other errors
- EncodeJSONResponse(err.Error(), &result.Code,{{#addResponseHeaders}} result.Headers,{{/addResponseHeaders}} w)
+ _ = EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest),{{#addResponseHeaders}} map[string][]string{},{{/addResponseHeaders}} w)
+ return
}
+
+ var requiredErr *RequiredError
+ if ok := errors.As(err, &requiredErr); ok {
+ // Handle missing required errors
+ _ = EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity),{{#addResponseHeaders}} map[string][]string{},{{/addResponseHeaders}} w)
+ return
+ }
+
+ // Handle all other errors
+ _ = EncodeJSONResponse(err.Error(), &result.Code,{{#addResponseHeaders}} result.Headers,{{/addResponseHeaders}} w)
}
diff --git a/modules/openapi-generator/src/main/resources/go-server/helpers.mustache b/modules/openapi-generator/src/main/resources/go-server/helpers.mustache
index ba5954ff46b8..de8a203d84b9 100644
--- a/modules/openapi-generator/src/main/resources/go-server/helpers.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/helpers.mustache
@@ -56,7 +56,7 @@ func AssertRecurseValueRequired[T any](value reflect.Value, callback func(T) err
// If it is a slice we continue recursion
case reflect.Slice:
- for i := 0; i < value.Len(); i += 1 {
+ for i := 0; i < value.Len(); i++ {
if err := AssertRecurseValueRequired(value.Index(i), callback); err != nil {
return err
}
diff --git a/modules/openapi-generator/src/main/resources/go-server/model.mustache b/modules/openapi-generator/src/main/resources/go-server/model.mustache
index 302b8448f50b..6ef715feb3a2 100644
--- a/modules/openapi-generator/src/main/resources/go-server/model.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/model.mustache
@@ -49,9 +49,9 @@ func New{{{classname}}}FromValue(v {{{format}}}{{^format}}{{dataType}}{{/format}
ev := {{{classname}}}(v)
if ev.IsValid() {
return ev, nil
- } else {
- return "", fmt.Errorf("invalid value '%v' for {{{classname}}}: valid values are %v", v, Allowed{{{classname}}}EnumValues)
}
+
+ return "", fmt.Errorf("invalid value '%v' for {{{classname}}}: valid values are %v", v, Allowed{{{classname}}}EnumValues)
}
{{/isEnum}}{{^isEnum}}{{#description}}
diff --git a/modules/openapi-generator/src/main/resources/go-server/routers.mustache b/modules/openapi-generator/src/main/resources/go-server/routers.mustache
index fb2d043076a9..207df91d9aad 100644
--- a/modules/openapi-generator/src/main/resources/go-server/routers.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/routers.mustache
@@ -64,8 +64,7 @@ func NewRouter(routers ...Router) {{#routers}}{{#mux}}*mux.Router{{/mux}}{{#chi}
{{/routers}}
for _, api := range routers {
for {{#routers}}{{#mux}}name{{/mux}}{{#chi}}_{{/chi}}{{/routers}}, route := range api.Routes() {
- var handler http.Handler
- handler = route.HandlerFunc
+ var handler http.Handler = route.HandlerFunc
{{#routers}}
{{#mux}}
handler = Logger(handler, name)
@@ -373,7 +372,7 @@ func parseNumericArrayParameter[T Number](param, delim string, required bool, fn
}
-// parseQuery parses query paramaters and returns an error if any malformed value pairs are encountered.
+// parseQuery parses query parameters and returns an error if any malformed value pairs are encountered.
func parseQuery(rawQuery string) (url.Values, error) {
return url.ParseQuery(rawQuery)
}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/go-server/service.mustache b/modules/openapi-generator/src/main/resources/go-server/service.mustache
index 799c68237397..52ddb6ac23b0 100644
--- a/modules/openapi-generator/src/main/resources/go-server/service.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/service.mustache
@@ -15,7 +15,7 @@ type {{classname}}Service struct {
}
// New{{classname}}Service creates a default api service
-func New{{classname}}Service() {{classname}}Servicer {
+func New{{classname}}Service() *{{classname}}Service {
return &{{classname}}Service{}
}{{#operations}}{{#operation}}
diff --git a/modules/openapi-generator/src/main/resources/htmlDocs2/paramB.mustache b/modules/openapi-generator/src/main/resources/htmlDocs2/paramB.mustache
index cd0dda30ea35..3ac8ed33fbb3 100644
--- a/modules/openapi-generator/src/main/resources/htmlDocs2/paramB.mustache
+++ b/modules/openapi-generator/src/main/resources/htmlDocs2/paramB.mustache
@@ -11,6 +11,8 @@ $(document).ready(function() {
}
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
+ } else if (schema.items != null && schema.items.$ref != null) {
+ schema.items = defsParser.$refs.get(schema.items.$ref);
} else {
schemaWrapper.definitions = Object.assign({}, defs);
$RefParser.dereference(schemaWrapper).catch(function(err) {
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache
index dfa555886b29..0652f569ebe3 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache
@@ -3,13 +3,13 @@ version '{{artifactVersion}}'
{{^omitGradleWrapper}}
wrapper {
- gradleVersion = '7.5'
+ gradleVersion = '8.7'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
{{/omitGradleWrapper}}
buildscript {
- ext.kotlin_version = '1.8.10'
+ ext.kotlin_version = '1.9.23'
{{#jvm-ktor}}
ext.ktor_version = '2.3.9'
{{/jvm-ktor}}
@@ -24,17 +24,13 @@ buildscript {
{{/jvm-vertx}}
{{#jvm-spring}}
{{#useSpringBoot3}}
- ext.spring_boot_version = "3.2.4"
+ ext.spring_boot_version = "3.2.5"
{{/useSpringBoot3}}
{{^useSpringBoot3}}
ext.spring_boot_version = "2.7.18"
{{/useSpringBoot3}}
- {{#jvm-spring-webclient}}
- ext.reactor_version = "3.6.4"
- {{/jvm-spring-webclient}}
{{/jvm-spring}}
- // 6.13.0 is the latest stable release that supports JDK8
- ext.spotless_version = "6.13.0"
+ ext.spotless_version = "6.25.0"
repositories {
maven { url "https://repo1.maven.org/maven2" }
@@ -167,7 +163,7 @@ dependencies {
{{/jvm-okhttp4}}
{{#jvm-spring-webclient}}
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
- implementation "io.projectreactor:reactor-core:$reactor_version"
+ implementation "io.projectreactor:reactor-core:3.6.5"
{{/jvm-spring-webclient}}
{{#jvm-spring-restclient}}
implementation "org.springframework.boot:spring-boot-starter-web:$spring_boot_version"
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/gradle-wrapper.jar b/modules/openapi-generator/src/main/resources/kotlin-client/gradle-wrapper.jar
index c1962a79e29d..d64cd4917707 100644
Binary files a/modules/openapi-generator/src/main/resources/kotlin-client/gradle-wrapper.jar and b/modules/openapi-generator/src/main/resources/kotlin-client/gradle-wrapper.jar differ
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/gradle-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/gradle-wrapper.properties.mustache
index 8707e8b5067f..6eb2a6bb7b23 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/gradle-wrapper.properties.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/gradle-wrapper.properties.mustache
@@ -1,6 +1,12 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
+{{#jvm-volley}}
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-all.zip
+{{/jvm-volley}}
+{{^jvm-volley}}
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
+{{/jvm-volley}}
networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/gradlew.bat.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/gradlew.bat.mustache
index 93e3f59f135d..9d0ce634cb11 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/gradlew.bat.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/gradlew.bat.mustache
@@ -1,92 +1,249 @@
-@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.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-: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
+#!/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/modules/openapi-generator/src/main/resources/kotlin-client/gradlew.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/gradlew.mustache
index aeb74cbb43e3..9d0ce634cb11 100755
--- a/modules/openapi-generator/src/main/resources/kotlin-client/gradlew.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/gradlew.mustache
@@ -69,34 +69,35 @@ 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" ]
+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
+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##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+# 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 "$*"
+echo "$*"
} >&2
die () {
- echo
- echo "$*"
- echo
- exit 1
+echo
+echo "$*"
+echo
+exit 1
} >&2
# OS specific support (must be 'true' or 'false').
@@ -105,10 +106,10 @@ msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
- CYGWIN* ) cygwin=true ;; #(
- Darwin* ) darwin=true ;; #(
- MSYS* | MINGW* ) msys=true ;; #(
- NONSTOP* ) nonstop=true ;;
+CYGWIN* ) cygwin=true ;; #(
+Darwin* ) darwin=true ;; #(
+MSYS* | MINGW* ) msys=true ;; #(
+NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -116,43 +117,46 @@ 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
+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
+fi
else
- JAVACMD=java
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+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=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=SC3045
- ulimit -n "$MAX_FD" ||
- warn "Could not set maximum file descriptor limit to $MAX_FD"
- esac
+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:
@@ -165,55 +169,55 @@ fi
# 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
+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, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+# 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 \
- "$@"
+"-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"
+die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
@@ -236,10 +240,10 @@ fi
#
eval "set -- $(
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
- xargs -n1 |
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
- tr '\n' ' '
- )" '"$@"'
+printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+xargs -n1 |
+sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+tr '\n' ' '
+)" '"$@"'
exec "$JAVACMD" "$@"
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache
index 35b33e9d029c..7af6f39c4eb4 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache
@@ -67,7 +67,7 @@ import {{packageName}}.infrastructure.*
@Deprecated(message = "This operation is deprecated.")
{{/isDeprecated}}
fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{#defaultValue}} = {{>param_default_value}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} {
- val result = {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
+ {{#returnType}}val result = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
{{#returnType}}
return result.body!!
{{/returnType}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/build.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/build.mustache
index a34e97f38725..62f0d98e6e35 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/build.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/build.mustache
@@ -5,7 +5,7 @@ project.version = '{{artifactVersion}}'
buildscript {
- ext.kotlin_version = '1.5.10'
+ ext.kotlin_version = '1.5.20'
ext.swagger_annotations_version = "1.6.2"
ext.gson_version = "2.8.6"
ext.volley_version = "1.2.0"
@@ -23,7 +23,7 @@ buildscript {
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'com.android.tools.build:gradle:4.0.2'
+ classpath 'com.android.tools.build:gradle:7.4.2'
{{#useAndroidMavenGradlePlugin}}
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
{{/useAndroidMavenGradlePlugin}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/settings.gradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/settings.gradle.mustache
index 32cef71d95a0..cc08101c2a29 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/settings.gradle.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/settings.gradle.mustache
@@ -1,2 +1 @@
-{{#multiplatform}}enableFeaturePreview('GRADLE_METADATA'){{/multiplatform}}
rootProject.name = '{{artifactId}}'
diff --git a/modules/openapi-generator/src/main/resources/php-flight/api.mustache b/modules/openapi-generator/src/main/resources/php-flight/api.mustache
index a0b146bd07dc..9824f8f8697d 100644
--- a/modules/openapi-generator/src/main/resources/php-flight/api.mustache
+++ b/modules/openapi-generator/src/main/resources/php-flight/api.mustache
@@ -11,7 +11,8 @@ namespace {{apiPackage}};
{{#operation}}
/**
* Operation {{{operationId}}}
- * Path: {{{path}}}
+ *
+ * Path: `{{{path}}}`
*
{{#summary}}
* {{{summary}}}
@@ -31,10 +32,11 @@ namespace {{apiPackage}};
throw new \Exception('Not implemented');
}
- {{#returnContainer}}
/**
* Operation {{{operationId}}} (stream)
*
+ * Path: `{{{path}}}`
+ *
{{#summary}}
* {{{summary}}}
*
@@ -51,7 +53,6 @@ namespace {{apiPackage}};
{
throw new \Exception('Not implemented');
}
- {{/returnContainer}}
{{/operation}}
}
{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache b/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache
index 42aebdee00a7..1056f6be4c8b 100644
--- a/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache
+++ b/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache
@@ -27,17 +27,16 @@ class RegisterRoutes {
);
{{^vendorExtensions.x-return-type-is-void}}
if ($result === null) {
- \Flight::halt(204);
+ \Flight::halt({{{vendorExtensions.x-default-status-code}}});
} else {
- \Flight::json($result);
+ \Flight::json($result, {{{vendorExtensions.x-default-status-code}}});
}
{{/vendorExtensions.x-return-type-is-void}}
{{#vendorExtensions.x-return-type-is-void}}
- \Flight::halt(204);
+ \Flight::halt({{{vendorExtensions.x-default-status-code}}});
{{/vendorExtensions.x-return-type-is-void}}
});
}
- {{#returnContainer}}
if (declaresMethod($reflectionClass, '{{operationId}}Stream')) {
\Flight::route('{{httpMethod}} {{vendorExtensions.x-path}}', function ({{#pathParams}}string ${{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) use ($handler) {
$r = \Flight::request();
@@ -47,9 +46,8 @@ class RegisterRoutes {
{{/vendorExtensions.x-nonFormParams}}
);
// ignore return value: streaming expected
- })->streamWithHeaders(['Content-Type' => 'application/json']);
+ })->streamWithHeaders(['status' => {{{vendorExtensions.x-default-status-code}}}{{#vendorExtensions.x-default-media-type}}, 'Content-Type' => '{{{vendorExtensions.x-default-media-type}}}'{{/vendorExtensions.x-default-media-type}}]);
}
- {{/returnContainer}}
{{/operation}}
{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache b/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache
index f33ba924deca..f7c286439a09 100644
--- a/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache
@@ -16,7 +16,7 @@ httptools==0.1.2
httpx==0.24.1
idna==3.7
itsdangerous==1.1.0
-Jinja2==2.11.3
+Jinja2==3.1.4
MarkupSafe==2.0.1
orjson==3.9.15
promise==2.3
diff --git a/modules/openapi-generator/src/main/resources/rust-axum/header.mustache b/modules/openapi-generator/src/main/resources/rust-axum/header.mustache
index 4d1cc4c6dccd..36bfcf45f7b7 100644
--- a/modules/openapi-generator/src/main/resources/rust-axum/header.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-axum/header.mustache
@@ -1,4 +1,4 @@
-use std::{convert::TryFrom, fmt, ops::Deref};
+use std::{convert::TryFrom, fmt, ops::Deref{{#renderUuidConversionImpl}}, str::FromStr{{/renderUuidConversionImpl}}};
use chrono::{DateTime, Utc};
use http::HeaderValue;
@@ -178,3 +178,39 @@ impl TryFrom>> for HeaderValue {
}
}
}
+
+{{#renderUuidConversionImpl}}
+// uuid::Uuid
+
+impl TryFrom for IntoHeaderValue {
+ type Error = String;
+
+ fn try_from(hdr_value: HeaderValue) -> Result {
+ match hdr_value.to_str() {
+ Ok(hdr_value) => match uuid::Uuid::from_str(hdr_value) {
+ Ok(uuid) => Ok(IntoHeaderValue(uuid)),
+ Err(e) => Err(format!("Unable to parse: {} as uuid - {}", hdr_value, e)),
+ },
+ Err(e) => Err(format!(
+ "Unable to convert header {:?} to string {}",
+ hdr_value, e
+ )),
+ }
+ }
+}
+
+impl TryFrom> for HeaderValue {
+ type Error = String;
+
+ fn try_from(hdr_value: IntoHeaderValue) -> Result {
+ match HeaderValue::from_bytes(hdr_value.0.as_bytes()) {
+ Ok(hdr_value) => Ok(hdr_value),
+ Err(e) => Err(format!(
+ "Unable to convert {:?} to a header: {}",
+ hdr_value, e
+ )),
+ }
+ }
+}
+
+{{/renderUuidConversionImpl}}
diff --git a/modules/openapi-generator/src/main/resources/rust-axum/lib.mustache b/modules/openapi-generator/src/main/resources/rust-axum/lib.mustache
index d96088f86a4a..b0b755b131f2 100644
--- a/modules/openapi-generator/src/main/resources/rust-axum/lib.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-axum/lib.mustache
@@ -6,9 +6,13 @@
unused_extern_crates,
non_camel_case_types,
unused_imports,
- unused_attributes
+ unused_attributes,
+)]
+#![allow(
+ clippy::derive_partial_eq_without_eq,
+ clippy::disallowed_names,
+ clippy::too_many_arguments
)]
-#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
use async_trait::async_trait;
use axum::extract::*;
diff --git a/modules/openapi-generator/src/main/resources/rust-axum/server-mod.mustache b/modules/openapi-generator/src/main/resources/rust-axum/server-mod.mustache
index 69a703ca0706..cf43a8dd11e1 100644
--- a/modules/openapi-generator/src/main/resources/rust-axum/server-mod.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-axum/server-mod.mustache
@@ -8,7 +8,9 @@ use crate::{Api{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}},
{{#apis}}
{{#operations}}
{{#operation}}
+{{^disableValidator}}
{{>server-operation-validate}}
+{{/disableValidator}}
{{>server-operation}}
{{/operation}}
{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
index 794a5f8be6b7..806211893fea 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
@@ -17,7 +17,7 @@ license = "{{.}}"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
{{/licenseInfo}}
-edition = "2018"
+edition = "2021"
{{#publishRustRegistry}}
publish = ["{{.}}"]
{{/publishRustRegistry}}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
index f82fe6f424e2..cbd262e97f1e 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
-#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
+#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names, clippy::too_many_arguments)]
use async_trait::async_trait;
use futures::Stream;
diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-make-service.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-make-service.mustache
index b2c7afd5fdf9..684406fbc03a 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/server-make-service.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/server-make-service.mustache
@@ -31,7 +31,7 @@ impl hyper::service::Service for MakeService where
}
fn call(&mut self, target: Target) -> Self::Future {
- futures::future::ok(Service::new(
+ future::ok(Service::new(
self.api_impl.clone(),
))
}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache
index f0ba616a9abc..3bc9b31296ca 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache
@@ -224,10 +224,11 @@
let deserializer = &mut serde_json::Deserializer::from_slice(&body);
{{/x-consumes-json}}
{{^x-consumes-plain-text}}
- match serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }) {
+ let handle_unknown_field = |path: serde_ignored::Path<'_>| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ };
+ match serde_ignored::deserialize(deserializer, handle_unknown_field) {
Ok(param_{{{paramName}}}) => param_{{{paramName}}},
{{#required}}
Err(e) => return Ok(Response::builder()
@@ -421,10 +422,11 @@
Some("{{{contentType}}}") if param_{{{paramName}}}.is_none() => {
// Extract JSON part.
let deserializer = &mut serde_json::Deserializer::from_slice(part.body.as_slice());
- let json_data: {{dataType}} = match serde_ignored::deserialize(deserializer, |path| {
+ let handle_unknown_field = |path: serde_ignored::Path<'_>| {
warn!("Ignoring unknown field in JSON part: {}", path);
unused_elements.push(path.to_string());
- }) {
+ };
+ let json_data: {{dataType}} = match serde_ignored::deserialize(deserializer, handle_unknown_field) {
Ok(json_data) => json_data,
Err(e) => return Ok(Response::builder()
.status(StatusCode::BAD_REQUEST)
diff --git a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
index d6fa2e3efcb6..7b4e15d25059 100644
--- a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
@@ -17,7 +17,7 @@ license = "{{.}}"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
{{/licenseInfo}}
-edition = "2018"
+edition = "2021"
{{#publishRustRegistry}}
publish = ["{{.}}"]
{{/publishRustRegistry}}
@@ -32,14 +32,13 @@ homepage = "{{.}}
{{/homePageUrl}}
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
{{#serdeWith}}
-serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] }
+serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] }
{{/serdeWith}}
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
{{#hyper}}
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
@@ -54,16 +53,15 @@ secrecy = "0.8.0"
{{/withAWSV4Signature}}
{{#reqwest}}
{{^supportAsync}}
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "blocking", "multipart"]
+reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
+{{#supportMiddleware}}
+reqwest-middleware = { version = "^0.3", features = ["json", "blocking", "multipart"] }
+{{/supportMiddleware}}
{{/supportAsync}}
{{#supportAsync}}
+reqwest = { version = "^0.12", features = ["json", "multipart"] }
{{#supportMiddleware}}
-reqwest-middleware = "0.2.0"
+reqwest-middleware = { version = "^0.3", features = ["json", "multipart"] }
{{/supportMiddleware}}
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "multipart"]
{{/supportAsync}}
{{/reqwest}}
diff --git a/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache b/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache
index 8314cb60b07b..51a42ef361a5 100644
--- a/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache
@@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
impl From for Error {
fn from(e: http::Error) -> Self {
- return Error::Http(e)
+ Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
- return Error::Hyper(e)
+ Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
- return Error::Serde(e)
+ Error::Serde(e)
}
}
diff --git a/modules/openapi-generator/src/main/resources/rust/lib.mustache b/modules/openapi-generator/src/main/resources/rust/lib.mustache
index 03ee005ea4c6..276ad12cfbbf 100644
--- a/modules/openapi-generator/src/main/resources/rust/lib.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/lib.mustache
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache
index 7c2c1bcd0080..94fcdf097eae 100644
--- a/modules/openapi-generator/src/main/resources/rust/model.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/model.mustache
@@ -1,5 +1,6 @@
{{>partial_header}}
use crate::models;
+use serde::{Deserialize, Serialize};
{{#models}}
{{#model}}
{{^isEnum}}{{#vendorExtensions.x-rust-has-byte-array}}
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
index 23c6300f99bb..f9e6e9db5990 100644
--- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
@@ -1,7 +1,7 @@
{{>partial_header}}
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
@@ -174,7 +174,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration:
{{/bodyParams}}
{{/hasBodyParam}}
{{^hasBodyParam}}
- &"",
+ "",
{{/hasBodyParam}}
) {
Ok(new_headers) => new_headers,
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache
index 0de2884a8bb8..fd6f7d052d97 100644
--- a/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache
@@ -64,7 +64,7 @@ impl AWSv4Key {
value.to_str().expect("header value should be a string").to_string()));
}
}
- return Ok(additional_headers);
+ Ok(additional_headers)
}
}
{{/withAWSV4Signature}}
diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache
index 95ca812b3597..f45e74d2339a 100644
--- a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache
@@ -174,13 +174,13 @@ export class {{classname}} {
* @deprecated
{{/isDeprecated}}
*/
- public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{{mediaType}}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>;
- public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{{mediaType}}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable>;
- public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{{mediaType}}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable>;
- public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: {{#produces}}'{{{mediaType}}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable {
+ public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters{{^hasRequiredVars}}?{{/hasRequiredVars}}: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{{mediaType}}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>;
+ public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters{{^hasRequiredVars}}?{{/hasRequiredVars}}: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{{mediaType}}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable>;
+ public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters{{^hasRequiredVars}}?{{/hasRequiredVars}}: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{{mediaType}}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable>;
+ public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters{{^hasRequiredVars}}?{{/hasRequiredVars}}: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: {{#produces}}'{{{mediaType}}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable {
{{#allParams}}
{{#useSingleRequestParameter}}
- const {{paramName}} = requestParameters.{{paramName}};
+ const {{paramName}} = requestParameters{{^hasRequiredVars}}?{{/hasRequiredVars}}.{{paramName}};
{{/useSingleRequestParameter}}
{{#required}}
if ({{paramName}} === null || {{paramName}} === undefined) {
diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
index e008a6d830ec..7ad585b93785 100644
--- a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
@@ -189,9 +189,14 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
{{#isArray}}
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
+ {{#contentType}}
+ localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "{{contentType}}", }));
+ {{/contentType}}
+ {{^contentType}}
{{paramName}}.forEach((element) => {
- localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
+ localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
})
+ {{/contentType}}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache
index 79c0ee1d59ee..312b6320e0df 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache
@@ -1,7 +1,14 @@
{{>modelEnumInterfaces}}
export function instanceOf{{classname}}(value: any): boolean {
- return Object.values({{classname}}).includes(value);
+ for (const key in {{classname}}) {
+ if (Object.prototype.hasOwnProperty.call({{classname}}, key)) {
+ if ({{classname}}[key] === value) {
+ return true;
+ }
+ }
+ }
+ return false;
}
export function {{classname}}FromJSON(json: any): {{classname}} {
diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache
index b8fd70ec4285..8e7d0344cd4a 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache
@@ -1,22 +1,19 @@
import { mapValues } from '../runtime{{importFileExtension}}';
{{#hasImports}}
-{{#imports}}
-import type { {{{.}}} } from './{{.}}{{importFileExtension}}';
+{{#tsImports}}
+import type { {{{classname}}} } from './{{filename}}{{importFileExtension}}';
import {
- {{.}}FromJSON,
- {{.}}FromJSONTyped,
- {{.}}ToJSON,
-} from './{{.}}{{importFileExtension}}';
-{{/imports}}
+ {{classname}}FromJSON,
+ {{classname}}FromJSONTyped,
+ {{classname}}ToJSON,
+} from './{{filename}}{{importFileExtension}}';
+{{/tsImports}}
{{/hasImports}}
{{#discriminator}}
-import {
{{#discriminator.mappedModels}}
- {{modelName}}FromJSONTyped{{^-last}},{{/-last}}
+import { {{modelName}}FromJSONTyped } from './{{modelName}}{{importFileExtension}}';
{{/discriminator.mappedModels}}
-} from './index{{importFileExtension}}';
-
{{/discriminator}}
{{>modelGenericInterfaces}}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ArchUnitRulesTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ArchUnitRulesTest.java
index 1eb57d9014f6..a4ca489e6b84 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ArchUnitRulesTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ArchUnitRulesTest.java
@@ -4,7 +4,7 @@
import com.tngtech.archunit.core.domain.JavaModifier;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import com.tngtech.archunit.lang.ArchRule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.*;
import static com.tngtech.archunit.library.GeneralCodingRules.NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS;
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java
index 54980a970529..8ac9d558e6db 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java
@@ -29,7 +29,6 @@
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
-import io.swagger.v3.oas.models.examples.Example;
import io.swagger.v3.oas.models.headers.Header;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.parameters.QueryParameter;
@@ -50,6 +49,8 @@
import org.testng.Assert;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;
+import org.junit.jupiter.api.Assertions;
+
import java.io.File;
import java.io.IOException;
@@ -57,7 +58,6 @@
import java.util.*;
import java.util.stream.Collectors;
-import static junit.framework.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.*;
@@ -72,7 +72,7 @@ public void testDeeplyNestedAdditionalPropertiesImports() {
codegen.setOpenAPI(openApi);
PathItem path = openApi.getPaths().get("/ping");
CodegenOperation operation = codegen.fromOperation("/ping", "post", path.getPost(), path.getServers());
- Assert.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("Person")).size(), 1);
+ Assertions.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("Person")).size(), 1);
}
@Test
@@ -82,7 +82,7 @@ public void testOptionalResponseImports() {
codegen.setOpenAPI(openApi);
PathItem path = openApi.getPaths().get("/api/Users/{userId}");
CodegenOperation operation = codegen.fromOperation("/api/Users/{userId}", "get", path.getGet(), path.getServers());
- Assert.assertEquals(operation.isResponseOptional, true);
+ Assertions.assertTrue(operation.isResponseOptional);
}
@Test
@@ -92,7 +92,7 @@ public void testEnumImports() {
codegen.setOpenAPI(openApi);
PathItem path = openApi.getPaths().get("/pets/petType/{type}");
CodegenOperation operation = codegen.fromOperation("/pets/petType/{type}", "get", path.getGet(), path.getServers());
- Assert.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("PetByType")).size(), 1);
+ Assertions.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("PetByType")).size(), 1);
}
@Test
@@ -116,8 +116,8 @@ public void testHasBodyParameter() {
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
- Assert.assertFalse(codegen.hasBodyParameter(pingOperation));
- Assert.assertTrue(codegen.hasBodyParameter(createOperation));
+ Assertions.assertFalse(codegen.hasBodyParameter(pingOperation));
+ Assertions.assertTrue(codegen.hasBodyParameter(createOperation));
}
@Test(expectedExceptions = RuntimeException.class)
@@ -128,7 +128,7 @@ public void testParameterEmptyDescription() {
}
@Test
- public void testGetConsumesInfoAndGetProducesInfo() throws Exception {
+ public void testGetConsumesInfoAndGetProducesInfo() {
final Schema refSchema = new Schema<>().$ref("#/components/schemas/Pet");
OpenAPI openAPI = new OpenAPI();
openAPI.setComponents(new Components());
@@ -151,61 +151,61 @@ public void testGetConsumesInfoAndGetProducesInfo() throws Exception {
new ApiResponses().addApiResponse("201", new ApiResponse()
.description("Created response")));
Set createConsumesInfo = DefaultCodegen.getConsumesInfo(openAPI, createOperation);
- Assert.assertEquals(createConsumesInfo.size(), 2);
- Assert.assertTrue(createConsumesInfo.contains("application/json"), "contains 'application/json'");
- Assert.assertTrue(createConsumesInfo.contains("application/xml"), "contains 'application/xml'");
+ Assertions.assertEquals(createConsumesInfo.size(), 2);
+ Assertions.assertTrue(createConsumesInfo.contains("application/json"), "contains 'application/json'");
+ Assertions.assertTrue(createConsumesInfo.contains("application/xml"), "contains 'application/xml'");
Set createProducesInfo = DefaultCodegen.getProducesInfo(openAPI, createOperation);
- Assert.assertEquals(createProducesInfo.size(), 0);
+ Assertions.assertEquals(createProducesInfo.size(), 0);
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
CodegenOperation coCreate = codegen.fromOperation("somepath", "post", createOperation, null);
- Assert.assertTrue(coCreate.hasConsumes);
- Assert.assertEquals(coCreate.consumes.size(), 2);
- Assert.assertFalse(coCreate.hasProduces);
+ Assertions.assertTrue(coCreate.hasConsumes);
+ Assertions.assertEquals(coCreate.consumes.size(), 2);
+ Assertions.assertFalse(coCreate.hasProduces);
Operation updateOperationWithRef = new Operation()
.requestBody(new RequestBody().$ref("#/components/requestBodies/MyRequestBody"))
.responses(new ApiResponses().addApiResponse("201", new ApiResponse().$ref("#/components/responses/MyResponse")));
Set updateConsumesInfo = DefaultCodegen.getConsumesInfo(openAPI, updateOperationWithRef);
- Assert.assertEquals(updateConsumesInfo.size(), 1);
- Assert.assertTrue(updateConsumesInfo.contains("application/json"), "contains 'application/json'");
+ Assertions.assertEquals(updateConsumesInfo.size(), 1);
+ Assertions.assertTrue(updateConsumesInfo.contains("application/json"), "contains 'application/json'");
Set updateProducesInfo = DefaultCodegen.getProducesInfo(openAPI, updateOperationWithRef);
- Assert.assertEquals(updateProducesInfo.size(), 1);
- Assert.assertTrue(updateProducesInfo.contains("application/xml"), "contains 'application/xml'");
+ Assertions.assertEquals(updateProducesInfo.size(), 1);
+ Assertions.assertTrue(updateProducesInfo.contains("application/xml"), "contains 'application/xml'");
CodegenOperation coUpdate = codegen.fromOperation("somepath", "post", updateOperationWithRef, null);
- Assert.assertTrue(coUpdate.hasConsumes);
- Assert.assertEquals(coUpdate.consumes.size(), 1);
- Assert.assertEquals(coUpdate.consumes.get(0).get("mediaType"), "application/json");
- Assert.assertTrue(coUpdate.hasProduces);
- Assert.assertEquals(coUpdate.produces.size(), 1);
- Assert.assertEquals(coUpdate.produces.get(0).get("mediaType"), "application/xml");
+ Assertions.assertTrue(coUpdate.hasConsumes);
+ Assertions.assertEquals(coUpdate.consumes.size(), 1);
+ Assertions.assertEquals(coUpdate.consumes.get(0).get("mediaType"), "application/json");
+ Assertions.assertTrue(coUpdate.hasProduces);
+ Assertions.assertEquals(coUpdate.produces.size(), 1);
+ Assertions.assertEquals(coUpdate.produces.get(0).get("mediaType"), "application/xml");
}
@Test
- public void testGetProducesInfo() throws Exception {
+ public void testGetProducesInfo() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/produces.yaml");
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
Operation textOperation = openAPI.getPaths().get("/ping/text").getGet();
CodegenOperation coText = codegen.fromOperation("/ping/text", "get", textOperation, null);
- Assert.assertTrue(coText.hasProduces);
- Assert.assertEquals(coText.produces.size(), 1);
- Assert.assertEquals(coText.produces.get(0).get("mediaType"), "text/plain");
+ Assertions.assertTrue(coText.hasProduces);
+ Assertions.assertEquals(coText.produces.size(), 1);
+ Assertions.assertEquals(coText.produces.get(0).get("mediaType"), "text/plain");
Operation jsonOperation = openAPI.getPaths().get("/ping/json").getGet();
CodegenOperation coJson = codegen.fromOperation("/ping/json", "get", jsonOperation, null);
- Assert.assertTrue(coJson.hasProduces);
- Assert.assertEquals(coJson.produces.size(), 1);
- Assert.assertEquals(coJson.produces.get(0).get("mediaType"), "application/json");
+ Assertions.assertTrue(coJson.hasProduces);
+ Assertions.assertEquals(coJson.produces.size(), 1);
+ Assertions.assertEquals(coJson.produces.get(0).get("mediaType"), "application/json");
Operation issue443Operation = openAPI.getPaths().get("/other/issue443").getGet();
CodegenOperation coIssue443 = codegen.fromOperation("/other/issue443", "get", issue443Operation, null);
- Assert.assertTrue(coIssue443.hasProduces);
- Assert.assertEquals(coIssue443.produces.size(), 2);
- Assert.assertEquals(coIssue443.produces.get(0).get("mediaType"), "application/json");
- Assert.assertEquals(coIssue443.produces.get(1).get("mediaType"), "application/text");
+ Assertions.assertTrue(coIssue443.hasProduces);
+ Assertions.assertEquals(coIssue443.produces.size(), 2);
+ Assertions.assertEquals(coIssue443.produces.get(0).get("mediaType"), "application/json");
+ Assertions.assertEquals(coIssue443.produces.get(1).get("mediaType"), "application/text");
}
@Test
@@ -213,8 +213,8 @@ public void testInitialConfigValues() throws Exception {
final DefaultCodegen codegen = new DefaultCodegen();
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
- Assert.assertTrue(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
+ Assertions.assertTrue(codegen.isHideGenerationTimestamp());
}
@Test
@@ -223,8 +223,8 @@ public void testSettersForConfigValues() throws Exception {
codegen.setHideGenerationTimestamp(false);
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
- Assert.assertFalse(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
+ Assertions.assertFalse(codegen.isHideGenerationTimestamp());
}
@Test
@@ -233,12 +233,12 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception {
codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, false);
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
- Assert.assertFalse(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
+ Assertions.assertFalse(codegen.isHideGenerationTimestamp());
}
@Test
- public void testArraySchemaIsNotIncludedInAliases() throws Exception {
+ public void testArraySchemaIsNotIncludedInAliases() {
final DefaultCodegen codegen = new DefaultCodegen();
Map schemas = new HashMap() {
{
@@ -249,7 +249,7 @@ public void testArraySchemaIsNotIncludedInAliases() throws Exception {
Map aliases = codegen.getAllAliases(schemas);
- Assert.assertEquals(aliases.size(), 0);
+ Assertions.assertEquals(aliases.size(), 0);
}
@Test
@@ -262,8 +262,8 @@ public void testFormParameterHasDefaultValue() {
ModelUtils.getSchemaFromRequestBody(openAPI.getPaths().get("/fake").getGet().getRequestBody()));
CodegenParameter codegenParameter = codegen.fromFormProperty("enum_form_string", (Schema) requestBodySchema.getProperties().get("enum_form_string"), new HashSet());
- Assert.assertEquals(codegenParameter.defaultValue, "-efg");
- Assert.assertEquals(codegenParameter.getSchema(), null);
+ Assertions.assertEquals(codegenParameter.defaultValue, "-efg");
+ Assertions.assertNull(codegenParameter.getSchema());
}
@Test
@@ -278,8 +278,8 @@ public void testDateTimeFormParameterHasDefaultValue() {
CodegenParameter codegenParameter = codegen.fromFormProperty("visitDate", (Schema) requestBodySchema.getProperties().get("visitDate"),
new HashSet<>());
- Assert.assertEquals(codegenParameter.defaultValue, "1971-12-19T03:39:57-08:00");
- Assert.assertEquals(codegenParameter.getSchema(), null);
+ Assertions.assertEquals(codegenParameter.defaultValue, "1971-12-19T03:39:57-08:00");
+ Assertions.assertNull(codegenParameter.getSchema());
}
@Test
@@ -288,13 +288,13 @@ public void testOriginalOpenApiDocumentVersion() {
String location = "src/test/resources/2_0/python-prior/petstore-with-fake-endpoints-models-for-testing.yaml";
OpenAPI openAPI = TestUtils.parseFlattenSpec(location);
SemVer version = ModelUtils.getOpenApiVersion(openAPI, location, null);
- Assert.assertEquals(version, new SemVer("2.0.0"));
+ Assertions.assertEquals(version, new SemVer("2.0.0"));
// Test with OAS 3.0 document.
location = "src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml";
openAPI = TestUtils.parseFlattenSpec(location);
version = ModelUtils.getOpenApiVersion(openAPI, location, null);
- Assert.assertEquals(version, new SemVer("3.0.0"));
+ Assertions.assertEquals(version, new SemVer("3.0.0"));
}
@Test
@@ -306,14 +306,14 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese
codegen.setDisallowAdditionalPropertiesIfNotPresent(true);
Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass");
- Assert.assertNull(schema.getAdditionalProperties());
+ Assertions.assertNull(schema.getAdditionalProperties());
Schema addProps = ModelUtils.getAdditionalProperties(schema);
// The petstore-with-fake-endpoints-models-for-testing.yaml does not set the
// 'additionalProperties' keyword for this model, hence assert the value to be null.
- Assert.assertNull(addProps);
+ Assertions.assertNull(addProps);
CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", schema);
- Assert.assertNull(cm.getAdditionalProperties());
+ Assertions.assertNull(cm.getAdditionalProperties());
// When the 'additionalProperties' keyword is not present, the model
// should allow undeclared properties. However, due to bug
// https://github.com/swagger-api/swagger-parser/issues/1369, the swagger
@@ -341,41 +341,41 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese
// This property has the following inline schema.
// additionalProperties:
// type: string
- Assert.assertNotNull(map_string_sc);
- Assert.assertNotNull(map_string_sc.getAdditionalProperties());
- Assert.assertNotNull(map_string_cp.getAdditionalProperties());
+ Assertions.assertNotNull(map_string_sc);
+ Assertions.assertNotNull(map_string_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_string_cp.getAdditionalProperties());
// map_with_additional_properties
// This property has the following inline schema.
// additionalProperties: true
- Assert.assertNotNull(map_with_additional_properties_sc);
+ Assertions.assertNotNull(map_with_additional_properties_sc);
// It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema.
// We cannot differentiate between 'additionalProperties' not present and
// additionalProperties: true.
// UPDATE fixed in swagger parser 2.1.14
- Assert.assertTrue((Boolean) map_with_additional_properties_sc.getAdditionalProperties());
+ Assertions.assertTrue((Boolean) map_with_additional_properties_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_with_additional_properties_sc);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties());
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties());
// map_without_additional_properties
// This property has the following inline schema.
// additionalProperties: false
- Assert.assertNotNull(map_without_additional_properties_sc);
+ Assertions.assertNotNull(map_without_additional_properties_sc);
// It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema.
// We cannot differentiate between 'additionalProperties' not present and
// additionalProperties: false.
// UPDATE fixed in swagger parser 2.1.14
- Assert.assertFalse((Boolean) map_without_additional_properties_sc.getAdditionalProperties());
+ Assertions.assertFalse((Boolean) map_without_additional_properties_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_without_additional_properties_sc);
- Assert.assertNull(addProps);
- Assert.assertNull(map_without_additional_properties_cp.getAdditionalProperties());
+ Assertions.assertNull(addProps);
+ Assertions.assertNull(map_without_additional_properties_cp.getAdditionalProperties());
// check of composed schema model
String schemaName = "Parent";
schema = openAPI.getComponents().getSchemas().get(schemaName);
cm = codegen.fromModel(schemaName, schema);
- Assert.assertNull(cm.getAdditionalProperties());
+ Assertions.assertNull(cm.getAdditionalProperties());
}
@Test
@@ -397,14 +397,14 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese
*/
Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass");
- Assert.assertNull(schema.getAdditionalProperties());
+ Assertions.assertNull(schema.getAdditionalProperties());
Schema addProps = ModelUtils.getAdditionalProperties(schema);
// The petstore-with-fake-endpoints-models-for-testing.yaml does not set the
// 'additionalProperties' keyword for this model, hence assert the value to be null.
- Assert.assertNull(addProps);
+ Assertions.assertNull(addProps);
CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", schema);
- Assert.assertNotNull(cm.getAdditionalProperties());
+ Assertions.assertNotNull(cm.getAdditionalProperties());
// When the 'additionalProperties' keyword is not present, the model
// should allow undeclared properties. However, due to bug
// https://github.com/swagger-api/swagger-parser/issues/1369, the swagger
@@ -432,41 +432,41 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese
// This property has the following inline schema.
// additionalProperties:
// type: string
- Assert.assertNotNull(map_string_sc);
- Assert.assertNotNull(map_string_sc.getAdditionalProperties());
- Assert.assertNotNull(map_string_cp.getAdditionalProperties());
+ Assertions.assertNotNull(map_string_sc);
+ Assertions.assertNotNull(map_string_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_string_cp.getAdditionalProperties());
// map_with_additional_properties
// This property has the following inline schema.
// additionalProperties: true
- Assert.assertNotNull(map_with_additional_properties_sc);
+ Assertions.assertNotNull(map_with_additional_properties_sc);
// It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema.
// We cannot differentiate between 'additionalProperties' not present and
// additionalProperties: true.
// UPDATE fixed in swagger parser 2.1.14
- Assert.assertTrue((Boolean) map_with_additional_properties_sc.getAdditionalProperties());
+ Assertions.assertTrue((Boolean) map_with_additional_properties_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_with_additional_properties_sc);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties());
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties());
// map_without_additional_properties
// This property has the following inline schema.
// additionalProperties: false
- Assert.assertNotNull(map_without_additional_properties_sc);
+ Assertions.assertNotNull(map_without_additional_properties_sc);
// It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema.
// We cannot differentiate between 'additionalProperties' not present and
// additionalProperties: false.
// UPDATE fixed in swagger parser 2.1.14
- Assert.assertFalse((Boolean) map_without_additional_properties_sc.getAdditionalProperties());
+ Assertions.assertFalse((Boolean) map_without_additional_properties_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_without_additional_properties_sc);
- Assert.assertEquals(addProps, null);
- Assert.assertNull(map_without_additional_properties_cp.getAdditionalProperties());
+ Assertions.assertEquals(addProps, null);
+ Assertions.assertNull(map_without_additional_properties_cp.getAdditionalProperties());
// check of composed schema model
String schemaName = "Parent";
schema = openAPI.getComponents().getSchemas().get(schemaName);
cm = codegen.fromModel(schemaName, schema);
- Assert.assertNotNull(cm.getAdditionalProperties());
+ Assertions.assertNotNull(cm.getAdditionalProperties());
}
@Test
@@ -478,15 +478,15 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese
codegen.setOpenAPI(openAPI);
Schema componentSchema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass");
- Assert.assertNull(componentSchema.getAdditionalProperties());
+ Assertions.assertNull(componentSchema.getAdditionalProperties());
// When the 'additionalProperties' keyword is not present, the schema may be
// extended with any undeclared properties.
Schema addProps = ModelUtils.getAdditionalProperties(componentSchema);
- Assert.assertNotNull(addProps);
- Assert.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(addProps);
+ Assertions.assertEquals(addProps, new Schema());
CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", componentSchema);
- Assert.assertNotNull(cm.getAdditionalProperties());
+ Assertions.assertNotNull(cm.getAdditionalProperties());
Map modelPropSchemas = componentSchema.getProperties();
Schema map_with_undeclared_properties_string_sc = modelPropSchemas.get("map_with_undeclared_properties_string");
@@ -518,60 +518,60 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese
// This property has the following inline schema.
// additionalProperties:
// type: string
- Assert.assertNotNull(map_with_undeclared_properties_string_sc);
- Assert.assertNotNull(map_with_undeclared_properties_string_sc.getAdditionalProperties());
- Assert.assertNotNull(map_with_undeclared_properties_string_cp.getAdditionalProperties());
+ Assertions.assertNotNull(map_with_undeclared_properties_string_sc);
+ Assertions.assertNotNull(map_with_undeclared_properties_string_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_with_undeclared_properties_string_cp.getAdditionalProperties());
// map_with_undeclared_properties_anytype_1
// This property does not use the additionalProperties keyword,
// which means by default undeclared properties are allowed.
- Assert.assertNotNull(map_with_undeclared_properties_anytype_1_sc);
- Assert.assertNull(map_with_undeclared_properties_anytype_1_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_1_sc);
+ Assertions.assertNull(map_with_undeclared_properties_anytype_1_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_with_undeclared_properties_anytype_1_sc);
- Assert.assertNotNull(addProps);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_undeclared_properties_anytype_1_cp.getAdditionalProperties());
+ Assertions.assertNotNull(addProps);
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_1_cp.getAdditionalProperties());
// map_with_undeclared_properties_anytype_2
// This property does not use the additionalProperties keyword,
// which means by default undeclared properties are allowed.
- Assert.assertNotNull(map_with_undeclared_properties_anytype_2_sc);
- Assert.assertNull(map_with_undeclared_properties_anytype_2_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_2_sc);
+ Assertions.assertNull(map_with_undeclared_properties_anytype_2_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_with_undeclared_properties_anytype_2_sc);
- Assert.assertNotNull(addProps);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_undeclared_properties_anytype_2_cp.getAdditionalProperties());
+ Assertions.assertNotNull(addProps);
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_2_cp.getAdditionalProperties());
// map_with_undeclared_properties_anytype_3
// This property has the following inline schema.
// additionalProperties: true
- Assert.assertNotNull(map_with_undeclared_properties_anytype_3_sc);
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_3_sc);
// Unlike the V2 spec, in V3 we CAN differentiate between 'additionalProperties' not present and
// additionalProperties: true.
- Assert.assertNotNull(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties());
- Assert.assertEquals(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties(), Boolean.TRUE);
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties());
+ Assertions.assertEquals(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties(), Boolean.TRUE);
addProps = ModelUtils.getAdditionalProperties(map_with_undeclared_properties_anytype_3_sc);
- Assert.assertNotNull(addProps);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_undeclared_properties_anytype_3_cp.getAdditionalProperties());
+ Assertions.assertNotNull(addProps);
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_3_cp.getAdditionalProperties());
// empty_map
// This property has the following inline schema.
// additionalProperties: false
- Assert.assertNotNull(empty_map_sc);
+ Assertions.assertNotNull(empty_map_sc);
// Unlike the V2 spec, in V3 we CAN differentiate between 'additionalProperties' not present and
// additionalProperties: false.
- Assert.assertNotNull(empty_map_sc.getAdditionalProperties());
- Assert.assertEquals(empty_map_sc.getAdditionalProperties(), Boolean.FALSE);
+ Assertions.assertNotNull(empty_map_sc.getAdditionalProperties());
+ Assertions.assertEquals(empty_map_sc.getAdditionalProperties(), Boolean.FALSE);
addProps = ModelUtils.getAdditionalProperties(empty_map_sc);
- Assert.assertNull(addProps);
- Assert.assertNull(empty_map_cp.getAdditionalProperties());
+ Assertions.assertNull(addProps);
+ Assertions.assertNull(empty_map_cp.getAdditionalProperties());
// check of composed schema model
String schemaName = "SomeObject";
Schema schema = openAPI.getComponents().getSchemas().get(schemaName);
cm = codegen.fromModel(schemaName, schema);
- Assert.assertNotNull(cm.getAdditionalProperties());
+ Assertions.assertNotNull(cm.getAdditionalProperties());
}
@Test
@@ -586,10 +586,10 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese
codegen.setOpenAPI(openAPI);
Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass");
- Assert.assertNull(schema.getAdditionalProperties());
+ Assertions.assertNull(schema.getAdditionalProperties());
Schema addProps = ModelUtils.getAdditionalProperties(schema);
- Assert.assertNull(addProps);
+ Assertions.assertNull(addProps);
}
@Test
@@ -601,8 +601,8 @@ public void testEnsureNoDuplicateProduces() {
Operation operation = openAPI.getPaths().get("/test").getGet();
CodegenOperation co = codegen.fromOperation("/test", "get", operation, null);
- Assert.assertEquals(co.produces.size(), 1);
- Assert.assertEquals(co.produces.get(0).get("mediaType"), "application/json");
+ Assertions.assertEquals(co.produces.size(), 1);
+ Assertions.assertEquals(co.produces.get(0).get("mediaType"), "application/json");
}
@Test
@@ -617,14 +617,14 @@ public void testConsistentParameterNameAfterUniquenessRename() throws Exception
DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
CodegenOperation co = codegen.fromOperation("/some/path", "get", operation, null);
- Assert.assertEquals(co.path, "/some/path");
- Assert.assertEquals(co.allParams.size(), 2);
+ Assertions.assertEquals(co.path, "/some/path");
+ Assertions.assertEquals(co.allParams.size(), 2);
List allParamsNames = co.allParams.stream().map(p -> p.paramName).collect(Collectors.toList());
- Assert.assertTrue(allParamsNames.contains("myparam"));
- Assert.assertTrue(allParamsNames.contains("myparam2"));
+ Assertions.assertTrue(allParamsNames.contains("myparam"));
+ Assertions.assertTrue(allParamsNames.contains("myparam2"));
List queryParamsNames = co.queryParams.stream().map(p -> p.paramName).collect(Collectors.toList());
- Assert.assertTrue(queryParamsNames.contains("myparam"));
- Assert.assertTrue(queryParamsNames.contains("myparam2"));
+ Assertions.assertTrue(queryParamsNames.contains("myparam"));
+ Assertions.assertTrue(queryParamsNames.contains("myparam2"));
}
@Test
@@ -634,11 +634,11 @@ public void testUniquenessRenameOfFormParameters() throws Exception {
codegen.setOpenAPI(openAPI);
Operation operation = openAPI.getPaths().get("/form-param-poc/{id}").getPut();
CodegenOperation co = codegen.fromOperation("/form-param-poc/{id}", "put", operation, null);
- Assert.assertEquals(co.path, "/form-param-poc/{id}");
- Assert.assertEquals(co.allParams.size(), 2);
+ Assertions.assertEquals(co.path, "/form-param-poc/{id}");
+ Assertions.assertEquals(co.allParams.size(), 2);
List allParamsNames = co.allParams.stream().map(p -> p.paramName).collect(Collectors.toList());
- Assert.assertTrue(allParamsNames.contains("id"));
- Assert.assertTrue(allParamsNames.contains("id2"));
+ Assertions.assertTrue(allParamsNames.contains("id"));
+ Assertions.assertTrue(allParamsNames.contains("id2"));
}
@Test
@@ -651,8 +651,8 @@ public void testGetSchemaTypeWithComposedSchemaWithOneOf() {
ModelUtils.getSchemaFromRequestBody(operation.getRequestBody()));
String type = codegen.getSchemaType(schema);
- Assert.assertNotNull(type);
- Assert.assertEquals(type, "oneOf");
+ Assertions.assertNotNull(type);
+ Assertions.assertEquals(type, "oneOf");
}
@Test
@@ -668,7 +668,7 @@ public void testOneOfEnum() {
Set oneOf = new TreeSet();
oneOf.add("Dog");
oneOf.add("Cat");
- Assert.assertEquals(petItems.oneOf, oneOf);
+ Assertions.assertEquals(petItems.oneOf, oneOf);
// make sure that animal has the property type
boolean typeSeen = false;
boolean typeContainsEnums = false;
@@ -681,14 +681,14 @@ public void testOneOfEnum() {
break;
}
}
- Assert.assertTrue(typeSeen);
- Assert.assertTrue(typeContainsEnums);
+ Assertions.assertTrue(typeSeen);
+ Assertions.assertTrue(typeContainsEnums);
- Assert.assertEquals(
+ Assertions.assertEquals(
((StringSchema) openAPI.getComponents().getSchemas().get("Dog").getProperties().get("type")).getEnum().size(),
1
);
- Assert.assertEquals(
+ Assertions.assertEquals(
((StringSchema) openAPI.getComponents().getSchemas().get("Cat").getProperties().get("type")).getEnum().size(),
1
);
@@ -707,7 +707,7 @@ public void testOneOfMergeProperties() {
Set oneOf = new TreeSet();
oneOf.add("Dog");
oneOf.add("Cat");
- Assert.assertEquals(pet.oneOf, oneOf);
+ Assertions.assertEquals(pet.oneOf, oneOf);
// make sure that animal has the property type
boolean typeSeen = false;
for (CodegenProperty cp : pet.vars) {
@@ -716,7 +716,7 @@ public void testOneOfMergeProperties() {
break;
}
}
- Assert.assertTrue(typeSeen);
+ Assertions.assertTrue(typeSeen);
}
@Test
@@ -731,9 +731,9 @@ public void testComposedSchemaOneOfWithProperties() {
Set oneOf = new TreeSet();
oneOf.add("Apple");
oneOf.add("Banana");
- Assert.assertEquals(fruit.oneOf, oneOf);
- Assert.assertEquals(fruit.optionalVars.size(), 3);
- Assert.assertEquals(fruit.vars.size(), 3);
+ Assertions.assertEquals(fruit.oneOf, oneOf);
+ Assertions.assertEquals(fruit.optionalVars.size(), 3);
+ Assertions.assertEquals(fruit.vars.size(), 3);
// make sure that fruit has the property color
boolean colorSeen = false;
for (CodegenProperty cp : fruit.vars) {
@@ -742,7 +742,7 @@ public void testComposedSchemaOneOfWithProperties() {
break;
}
}
- Assert.assertTrue(colorSeen);
+ Assertions.assertTrue(colorSeen);
colorSeen = false;
for (CodegenProperty cp : fruit.optionalVars) {
if ("color".equals(cp.name)) {
@@ -750,19 +750,19 @@ public void testComposedSchemaOneOfWithProperties() {
break;
}
}
- Assert.assertTrue(colorSeen);
+ Assertions.assertTrue(colorSeen);
}
@Test
public void testEscapeText() {
final DefaultCodegen codegen = new DefaultCodegen();
- Assert.assertEquals(codegen.escapeText("\n"), " ");
- Assert.assertEquals(codegen.escapeText("\r"), " ");
- Assert.assertEquals(codegen.escapeText("\t"), " ");
- Assert.assertEquals(codegen.escapeText("\\"), "\\\\");
- Assert.assertEquals(codegen.escapeText("\""), "\\\"");
- Assert.assertEquals(codegen.escapeText("\\/"), "/");
+ Assertions.assertEquals(codegen.escapeText("\n"), " ");
+ Assertions.assertEquals(codegen.escapeText("\r"), " ");
+ Assertions.assertEquals(codegen.escapeText("\t"), " ");
+ Assertions.assertEquals(codegen.escapeText("\\"), "\\\\");
+ Assertions.assertEquals(codegen.escapeText("\""), "\\\"");
+ Assertions.assertEquals(codegen.escapeText("\\/"), "/");
}
@Test
@@ -770,14 +770,14 @@ public void testEscapeTextWhileAllowingNewLines() {
final DefaultCodegen codegen = new DefaultCodegen();
// allow new lines
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\n"), "\n");
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\r"), "\r");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\n"), "\n");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\r"), "\r");
// escape other special characters
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\t"), " ");
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\\"), "\\\\");
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\""), "\\\"");
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\\/"), "/");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\t"), " ");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\\"), "\\\\");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\""), "\\\"");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\\/"), "/");
}
@Test
@@ -788,12 +788,12 @@ public void updateCodegenPropertyEnum() {
codegen.updateCodegenPropertyEnum(array);
List> enumVars = (List>) array.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars);
Map testedEnumVar = enumVars.get(0);
- Assert.assertNotNull(testedEnumVar);
- Assert.assertEquals(testedEnumVar.getOrDefault("name", ""), "_1");
- Assert.assertEquals(testedEnumVar.getOrDefault("value", ""), "\"1\"");
- Assert.assertEquals(testedEnumVar.getOrDefault("isString", ""), false);
+ Assertions.assertNotNull(testedEnumVar);
+ Assertions.assertEquals(testedEnumVar.getOrDefault("name", ""), "_1");
+ Assertions.assertEquals(testedEnumVar.getOrDefault("value", ""), "\"1\"");
+ Assertions.assertEquals(testedEnumVar.getOrDefault("isString", ""), false);
}
@Test
@@ -802,39 +802,39 @@ public void updateCodegenPropertyEnumWithExtension() {
CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("dog", "cat"), Arrays.asList("DOGVAR", "CATVAR"));
(new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\"");
}
{
CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("1", "2"), Arrays.asList("ONE", "TWO"));
(new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars");
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ONE");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"1\"");
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "TWO");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"2\"");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ONE");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"1\"");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "TWO");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"2\"");
}
{
CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("a", "b", "c", "d"), Arrays.asList("FOO", "BAR"));
(new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars");
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO");
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR");
- Assert.assertEquals(enumVars.get(2).getOrDefault("name", ""), "C");
- Assert.assertEquals(enumVars.get(3).getOrDefault("name", ""), "D");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR");
+ Assertions.assertEquals(enumVars.get(2).getOrDefault("name", ""), "C");
+ Assertions.assertEquals(enumVars.get(3).getOrDefault("name", ""), "D");
}
{
CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("a", "b"), Arrays.asList("FOO", "BAR", "BAZ"));
(new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars");
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO");
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR");
- Assert.assertEquals(enumVars.size(), 2);
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR");
+ Assertions.assertEquals(enumVars.size(), 2);
}
}
@@ -846,13 +846,13 @@ public void updateCodegenPropertyEnumWithPrefixRemoved() {
codegen.updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOG");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CAT");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOG");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CAT");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
}
@Test
@@ -865,13 +865,13 @@ public void updateCodegenPropertyEnumWithoutPrefixRemoved() {
codegen.updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ANIMAL_DOG");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "ANIMAL_CAT");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ANIMAL_DOG");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "ANIMAL_CAT");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
}
@Test
@@ -883,13 +883,13 @@ public void postProcessModelsEnumWithPrefixRemoved() {
codegen.postProcessModelsEnum(objs);
List> enumVars = (List>) cm.getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOG");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CAT");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOG");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CAT");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
}
@Test
@@ -902,13 +902,13 @@ public void postProcessModelsEnumWithoutPrefixRemoved() {
codegen.postProcessModelsEnum(objs);
List> enumVars = (List>) cm.getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ANIMAL_DOG");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "ANIMAL_CAT");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ANIMAL_DOG");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "ANIMAL_CAT");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
}
@Test
@@ -920,15 +920,15 @@ public void postProcessModelsEnumWithExtension() {
codegen.postProcessModelsEnum(objs);
List> enumVars = (List>) cm.getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\"");
- Assert.assertEquals(enumVars.get(0).getOrDefault("enumDescription", ""), "This is a dog");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\"");
- Assert.assertEquals(enumVars.get(1).getOrDefault("enumDescription", ""), "This is a cat");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\"");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("enumDescription", ""), "This is a dog");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\"");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("enumDescription", ""), "This is a cat");
}
@Test
@@ -940,15 +940,15 @@ public void testExample1() {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter, operation.getParameters().get(0));
- Assert.assertEquals(codegenParameter.example, "example1 value");
+ Assertions.assertEquals(codegenParameter.example, "example1 value");
Operation operation2 = openAPI.getPaths().get("/example1/plural").getGet();
CodegenParameter codegenParameter2 = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter2, operation2.getParameters().get(0));
- Assert.assertEquals(codegenParameter2.example, "An example1 value");
+ Assertions.assertEquals(codegenParameter2.example, "An example1 value");
// verify examples are available
codegen.setParameterExamples(codegenParameter2, operation2.getParameters().get(0));
- Assert.assertEquals(codegenParameter2.examples.size(), 1);
+ Assertions.assertEquals(codegenParameter2.examples.size(), 1);
}
@Test
@@ -960,7 +960,7 @@ public void testExample2() {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter, operation.getParameters().get(0));
- Assert.assertEquals(codegenParameter.example, "example2 value");
+ Assertions.assertEquals(codegenParameter.example, "example2 value");
}
@Test
@@ -972,13 +972,13 @@ public void testExample3() {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter, operation.getParameters().get(0));
- Assert.assertEquals(codegenParameter.example, "example3: parameter value");
+ Assertions.assertEquals(codegenParameter.example, "example3: parameter value");
Operation operation2 = openAPI.getPaths().get("/example3/plural").getGet();
CodegenParameter codegenParameter2 = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter2, operation2.getParameters().get(0));
- Assert.assertEquals(codegenParameter2.example, "An example3 value");
+ Assertions.assertEquals(codegenParameter2.example, "An example3 value");
}
@Test
@@ -990,13 +990,13 @@ public void testExample4() {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter, operation.getRequestBody());
- Assert.assertEquals(codegenParameter.example, "example4 value");
+ Assertions.assertEquals(codegenParameter.example, "example4 value");
Operation operation2 = openAPI.getPaths().get("/example4/plural").getPost();
CodegenParameter codegenParameter2 = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter2, operation2.getRequestBody());
- Assert.assertEquals(codegenParameter2.example, "An example4 value");
+ Assertions.assertEquals(codegenParameter2.example, "An example4 value");
}
@Test
@@ -1010,23 +1010,23 @@ public void testExample5MultipleResponses() {
CodegenOperation codegenOperation = codegen.fromOperation(path, "GET", operation, null);
List> examples = codegenOperation.examples;
- Assert.assertEquals(examples.size(), 4);
+ Assertions.assertEquals(examples.size(), 4);
// 200 response example
- Assert.assertEquals(examples.get(0).get("contentType"), "application/json");
- Assert.assertEquals(examples.get(0).get("example"), "\"a successful response example\"");
- Assert.assertEquals(examples.get(0).get("statusCode"), "200");
+ Assertions.assertEquals(examples.get(0).get("contentType"), "application/json");
+ Assertions.assertEquals(examples.get(0).get("example"), "\"a successful response example\"");
+ Assertions.assertEquals(examples.get(0).get("statusCode"), "200");
// 301 response example
- Assert.assertEquals(examples.get(1).get("contentType"), "application/json");
- Assert.assertEquals(examples.get(1).get("example"), "\"a redirect response example\"");
- Assert.assertEquals(examples.get(1).get("statusCode"), "301");
+ Assertions.assertEquals(examples.get(1).get("contentType"), "application/json");
+ Assertions.assertEquals(examples.get(1).get("example"), "\"a redirect response example\"");
+ Assertions.assertEquals(examples.get(1).get("statusCode"), "301");
// 404 response example
- Assert.assertEquals(examples.get(2).get("contentType"), "application/json");
- Assert.assertEquals(examples.get(2).get("example"), "\"a not found response example\"");
- Assert.assertEquals(examples.get(2).get("statusCode"), "404");
+ Assertions.assertEquals(examples.get(2).get("contentType"), "application/json");
+ Assertions.assertEquals(examples.get(2).get("example"), "\"a not found response example\"");
+ Assertions.assertEquals(examples.get(2).get("statusCode"), "404");
// 500 response example
- Assert.assertEquals(examples.get(3).get("contentType"), "application/json");
- Assert.assertEquals(examples.get(3).get("example"), "\"an internal server error response example\"");
- Assert.assertEquals(examples.get(3).get("statusCode"), "500");
+ Assertions.assertEquals(examples.get(3).get("contentType"), "application/json");
+ Assertions.assertEquals(examples.get(3).get("example"), "\"an internal server error response example\"");
+ Assertions.assertEquals(examples.get(3).get("statusCode"), "500");
}
@Test
@@ -1044,8 +1044,8 @@ public void testDiscriminator() {
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Dog", "Dog"));
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Cat", "Cat"));
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("BigCat", "BigCat"));
- Assert.assertEquals(discriminator, test);
- Assert.assertEquals(animalModel.getHasDiscriminatorWithNonEmptyMapping(), true);
+ Assertions.assertEquals(discriminator, test);
+ Assertions.assertTrue(animalModel.getHasDiscriminatorWithNonEmptyMapping());
}
@Test
@@ -1064,7 +1064,7 @@ public void testDiscriminatorWithCustomMapping() {
codegen.setOpenAPI(openAPI);
CodegenModel personModel = codegen.fromModel("Person", person);
verifyPersonDiscriminator(personModel.discriminator);
- Assert.assertEquals(personModel.getHasDiscriminatorWithNonEmptyMapping(), true);
+ Assertions.assertTrue(personModel.getHasDiscriminatorWithNonEmptyMapping());
}
@Test
@@ -1075,8 +1075,8 @@ public void testParentName() {
Schema child = openAPI.getComponents().getSchemas().get("Child");
codegen.setOpenAPI(openAPI);
CodegenModel childModel = codegen.fromModel("Child", child);
- Assert.assertEquals(childModel.parentSchema, "Person");
- Assert.assertEquals(childModel.getHasDiscriminatorWithNonEmptyMapping(), false);
+ Assertions.assertEquals(childModel.parentSchema, "Person");
+ Assertions.assertFalse(childModel.getHasDiscriminatorWithNonEmptyMapping());
}
@Test
@@ -1087,7 +1087,7 @@ public void testAllOfRequired() {
Schema child = openAPI.getComponents().getSchemas().get("clubForCreation");
codegen.setOpenAPI(openAPI);
CodegenModel childModel = codegen.fromModel("clubForCreation", child);
- Assert.assertEquals(getRequiredVars(childModel), Collections.singletonList("name"));
+ Assertions.assertEquals(getRequiredVars(childModel), Collections.singletonList("name"));
}
@Test
@@ -1100,20 +1100,20 @@ public void testAllOfSingleAndDoubleRefWithOwnPropsNoDiscriminator() {
// to test allOf with double refs
Schema supermanSchema = openAPI.getComponents().getSchemas().get("SuperMan");
CodegenModel supermanModel = codegen.fromModel("SuperMan", supermanSchema);
- Assert.assertNull(supermanModel.parent);
- Assert.assertEquals(supermanModel.allParents, null);
+ Assertions.assertNull(supermanModel.parent);
+ Assertions.assertNull(supermanModel.allParents);
// to test allOf with single ref
Schema superboySchema = openAPI.getComponents().getSchemas().get("SuperBoy");
CodegenModel superboyModel = codegen.fromModel("SuperBoy", superboySchema);
- Assert.assertNull(superboyModel.parent);
- Assert.assertEquals(superboyModel.allParents, null);
+ Assertions.assertNull(superboyModel.parent);
+ Assertions.assertNull(superboyModel.allParents);
// to test allOf with single ref and no "type: object" in the (last) inline schema
Schema superbabySchema = openAPI.getComponents().getSchemas().get("SuperBaby");
CodegenModel superbabyModel = codegen.fromModel("SuperBaby", superbabySchema);
- Assert.assertNull(superbabyModel.parent);
- Assert.assertEquals(superbabyModel.allParents, null);
+ Assertions.assertNull(superbabyModel.parent);
+ Assertions.assertNull(superbabyModel.allParents);
}
@Test
@@ -1125,8 +1125,8 @@ public void testAllParents() {
Schema adultSchema = openAPI.getComponents().getSchemas().get("Adult");
CodegenModel adultModel = codegen.fromModel("Adult", adultSchema);
- Assert.assertEquals(adultModel.parent, "Person");
- Assert.assertEquals(adultModel.allParents, Collections.singletonList("Person"));
+ Assertions.assertEquals(adultModel.parent, "Person");
+ Assertions.assertEquals(adultModel.allParents, Collections.singletonList("Person"));
}
@Test
@@ -1149,8 +1149,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
for (String leafModelName : leafModelNames) {
Schema leafSc = openAPI.getComponents().getSchemas().get(leafModelName);
CodegenModel leafCm = codegen.fromModel(leafModelName, leafSc);
- Assert.assertEquals(leafCm.discriminator, emptyMapDisc);
- Assert.assertEquals(leafCm.getHasDiscriminatorWithNonEmptyMapping(), false);
+ Assertions.assertEquals(leafCm.discriminator, emptyMapDisc);
+ Assertions.assertFalse(leafCm.getHasDiscriminatorWithNonEmptyMapping());
}
// the Pet discriminator map contains all animals + Reptile (children + grandchildren)
@@ -1166,8 +1166,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
modelName = "Pet";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel pet = codegen.fromModel(modelName, sc);
- Assert.assertEquals(pet.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(pet.discriminator, petDisc);
+ Assertions.assertTrue(pet.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(pet.discriminator, petDisc);
// the Reptile discriminator contains both reptiles
List reptileModelNames = Arrays.asList("Lizard", "Snake");
@@ -1182,8 +1182,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
modelName = "Reptile";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel reptile = codegen.fromModel(modelName, sc);
- Assert.assertEquals(reptile.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(reptile.discriminator, reptileDisc);
+ Assertions.assertTrue(reptile.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(reptile.discriminator, reptileDisc);
// the MyPets discriminator contains Cat and Lizard
List myPetNames = Arrays.asList("Cat", "Lizard");
@@ -1198,15 +1198,15 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
modelName = "MyPets";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel myPets = codegen.fromModel(modelName, sc);
- Assert.assertEquals(myPets.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(myPets.discriminator, myPetDisc);
+ Assertions.assertTrue(myPets.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(myPets.discriminator, myPetDisc);
// the MyPetsNoDisc discriminator is created because all oneOf classes have the same discriminator
modelName = "MyPetsNoDisc";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel myPetsNoDisc = codegen.fromModel(modelName, sc);
- Assert.assertEquals(myPetsNoDisc.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(myPetsNoDisc.discriminator, myPetDisc);
+ Assertions.assertTrue(myPetsNoDisc.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(myPetsNoDisc.discriminator, myPetDisc);
CodegenModel cm;
@@ -1217,8 +1217,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
hs.clear();
hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"), true));
hs.add(new CodegenDiscriminator.MappedModel("C", codegen.toModelName("C")));
- Assert.assertEquals(cm.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertTrue(cm.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// the mapping in b is in B
modelName = "B";
@@ -1227,8 +1227,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
hs.clear();
hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"), true));
hs.add(new CodegenDiscriminator.MappedModel("C", codegen.toModelName("C")));
- Assert.assertEquals(cm.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertTrue(cm.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// the mapping in b is in C
modelName = "C";
@@ -1236,8 +1236,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
cm = codegen.fromModel(modelName, sc);
hs.clear();
hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"), true));
- Assert.assertEquals(cm.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertTrue(cm.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
}
@Test
@@ -1260,7 +1260,7 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
for (String leafModelName : leafModelNames) {
Schema leafSc = openAPI.getComponents().getSchemas().get(leafModelName);
CodegenModel leafCm = codegen.fromModel(leafModelName, leafSc);
- Assert.assertNull(leafCm.discriminator);
+ Assertions.assertNull(leafCm.discriminator);
}
// the Pet discriminator map contains all animals + Reptile (children + grandchildren)
@@ -1276,7 +1276,7 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
modelName = "Pet";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel pet = codegen.fromModel(modelName, sc);
- Assert.assertEquals(pet.discriminator, petDisc);
+ Assertions.assertEquals(pet.discriminator, petDisc);
// the Reptile discriminator contains both reptiles
List reptileModelNames = Arrays.asList("Lizard", "Snake");
@@ -1291,7 +1291,7 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
modelName = "Reptile";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel reptile = codegen.fromModel(modelName, sc);
- Assert.assertNull(reptile.discriminator);
+ Assertions.assertNull(reptile.discriminator);
// the MyPets discriminator contains Cat and Lizard
CodegenDiscriminator myPetDisc = new CodegenDiscriminator();
@@ -1301,13 +1301,13 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
modelName = "MyPets";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel myPets = codegen.fromModel(modelName, sc);
- Assert.assertEquals(myPets.discriminator, myPetDisc);
+ Assertions.assertEquals(myPets.discriminator, myPetDisc);
// the MyPetsNoDisc discriminator is created because all oneOf classes have the same discriminator
modelName = "MyPetsNoDisc";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel myPetsNoDisc = codegen.fromModel(modelName, sc);
- Assert.assertNull(myPetsNoDisc.discriminator);
+ Assertions.assertNull(myPetsNoDisc.discriminator);
CodegenModel cm;
@@ -1317,19 +1317,19 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
cm = codegen.fromModel(modelName, sc);
hs.clear();
hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"), true));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// the mapping in b is in B
modelName = "B";
sc = openAPI.getComponents().getSchemas().get(modelName);
cm = codegen.fromModel(modelName, sc);
- Assert.assertNull(cm.discriminator);
+ Assertions.assertNull(cm.discriminator);
// the mapping in b is in C
modelName = "C";
sc = openAPI.getComponents().getSchemas().get(modelName);
cm = codegen.fromModel(modelName, sc);
- Assert.assertNull(cm.discriminator);
+ Assertions.assertNull(cm.discriminator);
}
@Test
@@ -1359,9 +1359,9 @@ public void testComposedSchemaOneOfDiscriminatorsInvalid() {
// comment out below as we're now showing warnings instead of throwing exceptions
try {
codegen.fromModel(modelName, sc);
- Assert.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not");
+ Assertions.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not");
} catch (RuntimeException re) {
- Assert.assertEquals(re.getMessage(), errorMessageExpected);
+ Assertions.assertEquals(re.getMessage(), errorMessageExpected);
}
*/
}
@@ -1394,9 +1394,9 @@ public void testComposedSchemaAnyOfDiscriminatorsInvalid() {
// comment out below as we're now showing warnings instead of throwing exceptions
try {
codegen.fromModel(modelName, sc);
- Assert.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not");
+ Assertions.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not");
} catch (RuntimeException re) {
- Assert.assertEquals(re.getMessage(), errorMessageExpected);
+ Assertions.assertEquals(re.getMessage(), errorMessageExpected);
}
*/
}
@@ -1424,13 +1424,13 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn)));
mn = "FruitInlineDisc_anyOf_1";
hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn)));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// inline anyOf with inline anyOf model doesn't work because we have null $refs and we throw an exception
final String fmodelName = "FruitInlineInlineDisc";
final Schema fsc = openAPI.getComponents().getSchemas().get(fmodelName);
// comment out below as we're now showing warnings instead of throwing exceptions
- //Assert.assertThrows(() -> codegen.fromModel(fmodelName, fsc));
+ //Assertions.assertThrows(() -> codegen.fromModel(fmodelName, fsc));
// ref anyOf models with discriminator in properties in those models
modelName = "FruitReqDisc";
@@ -1441,7 +1441,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaReqDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in allOf in those models
modelName = "FruitAllOfDisc";
@@ -1452,7 +1452,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAllOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in anyOf in those models
modelName = "FruitAnyOfDisc";
@@ -1463,7 +1463,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAnyOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in anyOf in those models
modelName = "FruitAnyOfDisc";
@@ -1474,7 +1474,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAnyOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in the grandparent schemas of those anyof models
modelName = "FruitGrandparentDisc";
@@ -1485,7 +1485,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaGrandparentDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
}
@Test
@@ -1510,13 +1510,13 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn)));
mn = "FruitInlineDisc_oneOf_1";
hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn)));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// inline oneOf with inline oneOf model doesn't work because we have null $refs and we throw an exception
final String fmodelName = "FruitInlineInlineDisc";
final Schema fsc = openAPI.getComponents().getSchemas().get(fmodelName);
// comment out below as we're now showing warnings instead of throwing exceptions
- //Assert.assertThrows(() -> codegen.fromModel(fmodelName, fsc));
+ //Assertions.assertThrows(() -> codegen.fromModel(fmodelName, fsc));
// ref oneOf models with discriminator in properties in those models
modelName = "FruitReqDisc";
@@ -1527,7 +1527,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaReqDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in allOf in those models
modelName = "FruitAllOfDisc";
@@ -1538,7 +1538,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAllOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in anyOf in those models
modelName = "FruitAnyOfDisc";
@@ -1549,7 +1549,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAnyOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in oneOf in those models
modelName = "FruitOneOfDisc";
@@ -1560,7 +1560,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaOneOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with enum property discriminator
modelName = "FruitOneOfEnumMappingDisc";
@@ -1577,7 +1577,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaGrandparentDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
}
@Test
@@ -1708,8 +1708,8 @@ public void verifyXDiscriminatorValue() {
// check that the model's children contain the x-discriminator-values
modelName = "BaseObj";
cm = getModel(allModels, modelName);
- Assert.assertNotNull(cm);
- Assert.assertNotNull(cm.children);
+ Assertions.assertNotNull(cm);
+ Assertions.assertNotNull(cm.children);
List expectedDiscriminatorValues = new ArrayList<>(Arrays.asList("daily", "sub-obj"));
ArrayList xDiscriminatorValues = new ArrayList<>();
for (CodegenModel child : cm.children) {
@@ -1738,9 +1738,9 @@ public void testAllOfSingleRefNoOwnProps() {
Schema schema = openAPI.getComponents().getSchemas().get("NewMessageEventCoreNoOwnProps");
codegen.setOpenAPI(openAPI);
CodegenModel model = codegen.fromModel("NewMessageEventCoreNoOwnProps", schema);
- Assert.assertEquals(getNames(model.getVars()), Arrays.asList("id", "message"));
- Assert.assertNull(model.parent);
- Assert.assertNull(model.allParents);
+ Assertions.assertEquals(getNames(model.getVars()), Arrays.asList("id", "message"));
+ Assertions.assertNull(model.parent);
+ Assertions.assertNull(model.allParents);
}
@Test
@@ -1751,15 +1751,15 @@ public void testAllOfParent() {
Schema person = openAPI.getComponents().getSchemas().get("person");
CodegenModel personModel = codegen.fromModel("person", person);
- Assert.assertEquals(getRequiredVars(personModel), Arrays.asList("firstName", "name", "email", "id"));
+ Assertions.assertEquals(getRequiredVars(personModel), Arrays.asList("firstName", "name", "email", "id"));
Schema personForCreation = openAPI.getComponents().getSchemas().get("personForCreation");
CodegenModel personForCreationModel = codegen.fromModel("personForCreation", personForCreation);
- Assert.assertEquals(getRequiredVars(personForCreationModel), Arrays.asList("firstName", "name", "email"));
+ Assertions.assertEquals(getRequiredVars(personForCreationModel), Arrays.asList("firstName", "name", "email"));
Schema personForUpdate = openAPI.getComponents().getSchemas().get("personForUpdate");
CodegenModel personForUpdateModel = codegen.fromModel("personForUpdate", personForUpdate);
- Assert.assertEquals(getRequiredVars(personForUpdateModel), Collections.emptyList());
+ Assertions.assertEquals(getRequiredVars(personForUpdateModel), Collections.emptyList());
}
private List getRequiredVars(CodegenModel model) {
@@ -1781,40 +1781,40 @@ public void testCallbacks() {
Operation subscriptionOperation = openAPI.getPaths().get("/streams").getPost();
CodegenOperation op = codegen.fromOperation(path, "post", subscriptionOperation, null);
- Assert.assertFalse(op.isCallbackRequest);
- Assert.assertNotNull(op.operationId);
- Assert.assertEquals(op.callbacks.size(), 2);
+ Assertions.assertFalse(op.isCallbackRequest);
+ Assertions.assertNotNull(op.operationId);
+ Assertions.assertEquals(op.callbacks.size(), 2);
CodegenCallback cbB = op.callbacks.get(1);
- Assert.assertEquals(cbB.name, "dummy");
- Assert.assertEquals(cbB.urls.size(), 0);
+ Assertions.assertEquals(cbB.name, "dummy");
+ Assertions.assertEquals(cbB.urls.size(), 0);
CodegenCallback cbA = op.callbacks.get(0);
- Assert.assertEquals(cbA.name, "onData");
+ Assertions.assertEquals(cbA.name, "onData");
- Assert.assertEquals(cbA.urls.size(), 2);
+ Assertions.assertEquals(cbA.urls.size(), 2);
CodegenCallback.Url urlB = cbA.urls.get(1);
- Assert.assertEquals(urlB.expression, "{$request.query.callbackUrl}/test");
- Assert.assertEquals(urlB.requests.size(), 0);
+ Assertions.assertEquals(urlB.expression, "{$request.query.callbackUrl}/test");
+ Assertions.assertEquals(urlB.requests.size(), 0);
CodegenCallback.Url urlA = cbA.urls.get(0);
- Assert.assertEquals(urlA.expression, "{$request.query.callbackUrl}/data");
- Assert.assertEquals(urlA.requests.size(), 2);
+ Assertions.assertEquals(urlA.expression, "{$request.query.callbackUrl}/data");
+ Assertions.assertEquals(urlA.requests.size(), 2);
urlA.requests.forEach(req -> {
- Assert.assertTrue(req.isCallbackRequest);
- Assert.assertNotNull(req.bodyParam);
- Assert.assertEquals(req.responses.size(), 2);
+ Assertions.assertTrue(req.isCallbackRequest);
+ Assertions.assertNotNull(req.bodyParam);
+ Assertions.assertEquals(req.responses.size(), 2);
switch (req.httpMethod.toLowerCase(Locale.getDefault())) {
case "post":
- Assert.assertEquals(req.operationId, "onDataDataPost");
- Assert.assertEquals(req.bodyParam.dataType, "NewNotificationData");
+ Assertions.assertEquals(req.operationId, "onDataDataPost");
+ Assertions.assertEquals(req.bodyParam.dataType, "NewNotificationData");
break;
case "delete":
- Assert.assertEquals(req.operationId, "onDataDataDelete");
- Assert.assertEquals(req.bodyParam.dataType, "DeleteNotificationData");
+ Assertions.assertEquals(req.operationId, "onDataDataDelete");
+ Assertions.assertEquals(req.bodyParam.dataType, "DeleteNotificationData");
break;
default:
Assert.fail(String.format(Locale.getDefault(), "invalid callback request http method '%s'", req.httpMethod));
@@ -1833,9 +1833,9 @@ public void testLeadingSlashIsAddedIfMissing() {
codegen.setOpenAPI(openAPI);
CodegenOperation co1 = codegen.fromOperation("/here", "get", operation2, null);
- Assert.assertEquals(co1.path, "/here");
+ Assertions.assertEquals(co1.path, "/here");
CodegenOperation co2 = codegen.fromOperation("some/path", "get", operation2, null);
- Assert.assertEquals(co2.path, "/some/path");
+ Assertions.assertEquals(co2.path, "/some/path");
}
@Test
@@ -1853,8 +1853,8 @@ public void testDefaultResponseShouldBeLast() {
codegen.setOpenAPI(openAPI);
CodegenOperation co = codegen.fromOperation("/here", "get", myOperation, null);
- Assert.assertEquals(co.responses.get(0).message, "Error");
- Assert.assertEquals(co.responses.get(1).message, "Default");
+ Assertions.assertEquals(co.responses.get(0).message, "Error");
+ Assertions.assertEquals(co.responses.get(1).message, "Default");
}
@Test
@@ -1871,8 +1871,8 @@ public void testResponseWithNoSchemaInHeaders() {
codegen.setOpenAPI(openAPI);
CodegenResponse cr = codegen.fromResponse("2XX", response2XX);
- Assert.assertNotNull(cr);
- Assert.assertTrue(cr.hasHeaders);
+ Assertions.assertNotNull(cr);
+ Assertions.assertTrue(cr.hasHeaders);
}
@Test
@@ -1884,7 +1884,7 @@ public void testNullableProperty() {
CodegenProperty property = codegen.fromProperty("address", (Schema) openAPI.getComponents().getSchemas().get("User").getProperties().get("address"));
- Assert.assertTrue(property.isNullable);
+ Assertions.assertTrue(property.isNullable);
}
@Test
@@ -1895,10 +1895,10 @@ public void testDeprecatedModel() {
codegen.setOpenAPI(openAPI);
CodegenModel codegenPetModel = codegen.fromModel("Pet", openAPI.getComponents().getSchemas().get("Pet"));
- Assert.assertTrue(codegenPetModel.isDeprecated);
+ Assertions.assertTrue(codegenPetModel.isDeprecated);
CodegenModel codegenFoodModel = codegen.fromModel("Food", openAPI.getComponents().getSchemas().get("Food"));
- Assert.assertTrue(codegenFoodModel.isDeprecated);
+ Assertions.assertTrue(codegenFoodModel.isDeprecated);
}
@Test
@@ -1911,10 +1911,10 @@ public void testDeprecatedProperty() {
final Map responseProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("Response").getProperties());
final Map requestProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("Response").getProperties());
- Assert.assertTrue(codegen.fromProperty("firstName", (Schema) responseProperties.get("firstName")).deprecated);
- Assert.assertFalse(codegen.fromProperty("customerCode", (Schema) responseProperties.get("customerCode")).deprecated);
- Assert.assertTrue(codegen.fromProperty("firstName", (Schema) requestProperties.get("firstName")).deprecated);
- Assert.assertFalse(codegen.fromProperty("customerCode", (Schema) requestProperties.get("customerCode")).deprecated);
+ Assertions.assertTrue(codegen.fromProperty("firstName", (Schema) responseProperties.get("firstName")).deprecated);
+ Assertions.assertFalse(codegen.fromProperty("customerCode", (Schema) responseProperties.get("customerCode")).deprecated);
+ Assertions.assertTrue(codegen.fromProperty("firstName", (Schema) requestProperties.get("firstName")).deprecated);
+ Assertions.assertFalse(codegen.fromProperty("customerCode", (Schema) requestProperties.get("customerCode")).deprecated);
}
@Test
@@ -1926,8 +1926,8 @@ public void testTitleProperty() {
final Map testProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("ModelWithTitledProperties").getProperties());
- Assert.assertEquals("Simple-Property-Title", codegen.fromProperty("simpleProperty", (Schema) testProperties.get("simpleProperty")).title);
- Assert.assertEquals("Ref-Property-Title", codegen.fromProperty("refProperty", (Schema) testProperties.get("refProperty")).title);
+ Assertions.assertEquals("Simple-Property-Title", codegen.fromProperty("simpleProperty", (Schema) testProperties.get("simpleProperty")).title);
+ Assertions.assertEquals("Ref-Property-Title", codegen.fromProperty("refProperty", (Schema) testProperties.get("refProperty")).title);
}
@Test
@@ -1939,8 +1939,8 @@ public void testDeprecatedRef() {
final Map requestProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("complex").getProperties());
- Assert.assertTrue(codegen.fromProperty("deprecated", (Schema) requestProperties.get("deprecated")).deprecated);
- Assert.assertFalse(codegen.fromProperty("current", (Schema) requestProperties.get("current")).deprecated);
+ Assertions.assertTrue(codegen.fromProperty("deprecated", (Schema) requestProperties.get("deprecated")).deprecated);
+ Assertions.assertFalse(codegen.fromProperty("current", (Schema) requestProperties.get("current")).deprecated);
}
@Test
@@ -1952,27 +1952,27 @@ public void integerSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "integer");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertTrue(cp.isInteger);
- Assert.assertFalse(cp.isLong);
- Assert.assertFalse(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertFalse(cp.isFloat);
- Assert.assertFalse(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "integer");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertTrue(cp.isInteger);
+ Assertions.assertFalse(cp.isLong);
+ Assertions.assertFalse(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertFalse(cp.isFloat);
+ Assertions.assertFalse(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "integer");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertTrue(cm.isInteger);
- Assert.assertFalse(cm.isLong);
- Assert.assertFalse(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertFalse(cm.isFloat);
- Assert.assertFalse(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "integer");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertTrue(cm.isInteger);
+ Assertions.assertFalse(cm.isLong);
+ Assertions.assertFalse(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertFalse(cm.isFloat);
+ Assertions.assertFalse(cm.isDouble);
}
@Test
@@ -1984,27 +1984,27 @@ public void longSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "long");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertFalse(cp.isInteger);
- Assert.assertTrue(cp.isLong);
- Assert.assertFalse(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertFalse(cp.isFloat);
- Assert.assertFalse(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "long");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertFalse(cp.isInteger);
+ Assertions.assertTrue(cp.isLong);
+ Assertions.assertFalse(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertFalse(cp.isFloat);
+ Assertions.assertFalse(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "long");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertFalse(cm.isInteger);
- Assert.assertTrue(cm.isLong);
- Assert.assertFalse(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertFalse(cm.isFloat);
- Assert.assertFalse(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "long");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertFalse(cm.isInteger);
+ Assertions.assertTrue(cm.isLong);
+ Assertions.assertFalse(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertFalse(cm.isFloat);
+ Assertions.assertFalse(cm.isDouble);
}
@Test
@@ -2016,27 +2016,27 @@ public void numberSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "number");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertFalse(cp.isInteger);
- Assert.assertFalse(cp.isLong);
- Assert.assertTrue(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertFalse(cp.isFloat);
- Assert.assertFalse(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "number");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertFalse(cp.isInteger);
+ Assertions.assertFalse(cp.isLong);
+ Assertions.assertTrue(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertFalse(cp.isFloat);
+ Assertions.assertFalse(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "number");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertFalse(cm.isInteger);
- Assert.assertFalse(cm.isLong);
- Assert.assertTrue(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertFalse(cm.isFloat);
- Assert.assertFalse(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "number");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertFalse(cm.isInteger);
+ Assertions.assertFalse(cm.isLong);
+ Assertions.assertTrue(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertFalse(cm.isFloat);
+ Assertions.assertFalse(cm.isDouble);
}
@Test
@@ -2048,27 +2048,27 @@ public void numberFloatSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "float");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertFalse(cp.isInteger);
- Assert.assertFalse(cp.isLong);
- Assert.assertFalse(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertTrue(cp.isFloat);
- Assert.assertFalse(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "float");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertFalse(cp.isInteger);
+ Assertions.assertFalse(cp.isLong);
+ Assertions.assertFalse(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertTrue(cp.isFloat);
+ Assertions.assertFalse(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "float");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertFalse(cm.isInteger);
- Assert.assertFalse(cm.isLong);
- Assert.assertFalse(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertTrue(cm.isFloat);
- Assert.assertFalse(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "float");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertFalse(cm.isInteger);
+ Assertions.assertFalse(cm.isLong);
+ Assertions.assertFalse(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertTrue(cm.isFloat);
+ Assertions.assertFalse(cm.isDouble);
}
@Test
@@ -2080,27 +2080,27 @@ public void numberDoubleSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "double");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertFalse(cp.isInteger);
- Assert.assertFalse(cp.isLong);
- Assert.assertFalse(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertFalse(cp.isFloat);
- Assert.assertTrue(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "double");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertFalse(cp.isInteger);
+ Assertions.assertFalse(cp.isLong);
+ Assertions.assertFalse(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertFalse(cp.isFloat);
+ Assertions.assertTrue(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "double");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertFalse(cm.isInteger);
- Assert.assertFalse(cm.isLong);
- Assert.assertFalse(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertFalse(cm.isFloat);
- Assert.assertTrue(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "double");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertFalse(cm.isInteger);
+ Assertions.assertFalse(cm.isLong);
+ Assertions.assertFalse(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertFalse(cm.isFloat);
+ Assertions.assertTrue(cm.isDouble);
}
@Test
@@ -2115,14 +2115,14 @@ public void testAlias() {
"MyParameterTextField",
openAPI.getComponents().getSchemas().get("MyParameterTextField")
);
- Assert.assertTrue(typeAliasModel.isAlias);
- Assert.assertEquals(typeAliasModel.dataType, "string");
+ Assertions.assertTrue(typeAliasModel.isAlias);
+ Assertions.assertEquals(typeAliasModel.dataType, "string");
CodegenModel composedModel = codegen.fromModel(
"ComposedModel",
openAPI.getComponents().getSchemas().get("ComposedModel")
);
- Assert.assertFalse(composedModel.isAlias);
+ Assertions.assertFalse(composedModel.isAlias);
}
private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) {
@@ -2134,7 +2134,7 @@ private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) {
test.getMapping().put("c", "Child");
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("a", "Adult", true));
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("c", "Child", true));
- Assert.assertEquals(discriminator, test);
+ Assertions.assertEquals(discriminator, test);
}
private CodegenProperty codegenPropertyWithArrayOfIntegerValues() {
@@ -2212,13 +2212,13 @@ public void objectQueryParamIdentifyAsObject() {
CodegenParameter parameter = codegen.fromParameter(openAPI.getPaths().get("/pony").getGet().getParameters().get(0), imports);
// TODO: This must be updated to work with flattened inline models
- Assert.assertEquals(parameter.dataType, "ListPageQueryParameter");
- Assert.assertEquals(imports.size(), 1);
- Assert.assertEquals(imports.iterator().next(), "ListPageQueryParameter");
+ Assertions.assertEquals(parameter.dataType, "ListPageQueryParameter");
+ Assertions.assertEquals(imports.size(), 1);
+ Assertions.assertEquals(imports.iterator().next(), "ListPageQueryParameter");
- Assert.assertNotNull(parameter.getSchema());
- Assert.assertEquals(parameter.getSchema().dataType, "Object");
- Assert.assertEquals(parameter.getSchema().baseType, "object");
+ Assertions.assertNotNull(parameter.getSchema());
+ Assertions.assertEquals(parameter.getSchema().dataType, "Object");
+ Assertions.assertEquals(parameter.getSchema().baseType, "object");
}
@Test
@@ -2234,7 +2234,7 @@ public void mapParamImportInnerObject() {
HashSet expected = Sets.newHashSet("InstrumentDefinition", "map");
- Assert.assertEquals(imports, expected);
+ Assertions.assertEquals(imports, expected);
}
@Test
@@ -2247,7 +2247,7 @@ public void modelDoNotContainInheritedVars() {
CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
}
@Test
@@ -2261,8 +2261,8 @@ public void importMapping() {
CodegenModel codegenModel = codegen.fromModel("ParentType", openAPI.getComponents().getSchemas().get("ParentType"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
- Assert.assertEquals(codegenModel.vars.get(0).getBaseType(), "string");
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.get(0).getBaseType(), "string");
}
@Test
@@ -2276,8 +2276,8 @@ public void schemaMapping() {
CodegenModel codegenModel = codegen.fromModel("ParentType", openAPI.getComponents().getSchemas().get("ParentType"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
- Assert.assertEquals(codegenModel.vars.get(0).getBaseType(), "TypeAlias");
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.get(0).getBaseType(), "TypeAlias");
}
@Test
@@ -2291,7 +2291,7 @@ public void modelWithPrefixDoNotContainInheritedVars() {
CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
}
@Test
@@ -2305,7 +2305,7 @@ public void modelWithSuffixDoNotContainInheritedVars() {
CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
}
@Test
@@ -2320,9 +2320,9 @@ public void arrayInnerReferencedSchemaMarkedAsModel_20() {
CodegenParameter codegenParameter = codegen.fromRequestBody(body, imports, "");
- Assert.assertTrue(codegenParameter.isContainer);
- Assert.assertTrue(codegenParameter.items.isModel);
- Assert.assertFalse(codegenParameter.items.isContainer);
+ Assertions.assertTrue(codegenParameter.isContainer);
+ Assertions.assertTrue(codegenParameter.items.isModel);
+ Assertions.assertFalse(codegenParameter.items.isContainer);
}
@Test
@@ -2338,9 +2338,9 @@ public void arrayInnerReferencedSchemaMarkedAsModel_30() {
CodegenParameter codegenParameter = codegen.fromRequestBody(body, imports, "");
- Assert.assertTrue(codegenParameter.isContainer);
- Assert.assertTrue(codegenParameter.items.isModel);
- Assert.assertFalse(codegenParameter.items.isContainer);
+ Assertions.assertTrue(codegenParameter.isContainer);
+ Assertions.assertTrue(codegenParameter.items.isModel);
+ Assertions.assertFalse(codegenParameter.items.isContainer);
}
@Test
@@ -2423,11 +2423,11 @@ public void testCircularReferencesDetection() {
codegen.setCircularReferences(models);
// then
- Assert.assertFalse(inboundOut.isCircularReference);
- Assert.assertTrue(roundANext.isCircularReference);
- Assert.assertTrue(roundBNext.isCircularReference);
- Assert.assertTrue(roundCNext.isCircularReference);
- Assert.assertFalse(roundCOut.isCircularReference);
+ Assertions.assertFalse(inboundOut.isCircularReference);
+ Assertions.assertTrue(roundANext.isCircularReference);
+ Assertions.assertTrue(roundBNext.isCircularReference);
+ Assertions.assertTrue(roundCNext.isCircularReference);
+ Assertions.assertFalse(roundCOut.isCircularReference);
}
@Test
@@ -2445,9 +2445,9 @@ public void testUseOneOfInterfaces() {
.getContent()
.get("application/json")
.getSchema());
- Assert.assertEquals(s.getExtensions().get("x-one-of-name"), "CreateStateRequest");
+ Assertions.assertEquals(s.getExtensions().get("x-one-of-name"), "CreateStateRequest");
- Assert.assertEquals(
+ Assertions.assertEquals(
openAPI.getPaths()
.get("/state")
.getGet()
@@ -2459,15 +2459,15 @@ public void testUseOneOfInterfaces() {
"#/components/schemas/getState_200_response"
);
Schema getState200 = openAPI.getComponents().getSchemas().get("getState_200_response");
- //Assert.assertEquals(getState200, "");
- Assert.assertEquals(getState200.getExtensions().get("x-one-of-name"), "GetState200Response");
+ //Assertions.assertEquals(getState200, "");
+ Assertions.assertEquals(getState200.getExtensions().get("x-one-of-name"), "GetState200Response");
// for the array schema, assert that a oneOf interface was added to schema map
Schema items = ((ArraySchema) openAPI.getComponents().getSchemas().get("CustomOneOfArraySchema")).getItems();
- Assert.assertEquals(items.get$ref(), "#/components/schemas/CustomOneOfArraySchema_inner");
- //Assert.assertEquals(items.get$ref(), "#/components/schemas/createState_request");
+ Assertions.assertEquals(items.get$ref(), "#/components/schemas/CustomOneOfArraySchema_inner");
+ //Assertions.assertEquals(items.get$ref(), "#/components/schemas/createState_request");
Schema innerItem = ModelUtils.getReferencedSchema(openAPI, openAPI.getComponents().getSchemas().get("CustomOneOfArraySchema_inner"));
- Assert.assertEquals(innerItem.getExtensions().get("x-one-of-name"), "CustomOneOfArraySchemaInner");
+ Assertions.assertEquals(innerItem.getExtensions().get("x-one-of-name"), "CustomOneOfArraySchemaInner");
}
@Test
@@ -2528,7 +2528,7 @@ public void testFormComposedSchema() {
"post",
path.getPost(),
path.getServers());
- Assert.assertEquals(operation.formParams.size(), 3,
+ Assertions.assertEquals(operation.formParams.size(), 3,
"The list of parameters should include inherited type");
final List names = operation.formParams.stream()
@@ -4325,21 +4325,21 @@ public void testUnalias() {
Schema requestBodySchema = ModelUtils.getSchemaFromRequestBody(
openAPI.getPaths().get("/thingy/{date}").getPost().getRequestBody());
- Assert.assertEquals(requestBodySchema.get$ref(), "#/components/schemas/updatePetWithForm_request");
- Assert.assertEquals(ModelUtils.getSimpleRef(requestBodySchema.get$ref()), "updatePetWithForm_request");
- Assert.assertNotNull(openAPI.getComponents().getSchemas().get(ModelUtils.getSimpleRef(requestBodySchema.get$ref())));
+ Assertions.assertEquals(requestBodySchema.get$ref(), "#/components/schemas/updatePetWithForm_request");
+ Assertions.assertEquals(ModelUtils.getSimpleRef(requestBodySchema.get$ref()), "updatePetWithForm_request");
+ Assertions.assertNotNull(openAPI.getComponents().getSchemas().get(ModelUtils.getSimpleRef(requestBodySchema.get$ref())));
Schema requestBodySchema2 = ModelUtils.unaliasSchema(openAPI, requestBodySchema);
// get$ref is not null as unaliasSchema returns the schema with the last $ref to the actual schema
- Assert.assertNotNull(requestBodySchema2.get$ref());
- Assert.assertEquals(requestBodySchema2.get$ref(), "#/components/schemas/updatePetWithForm_request");
+ Assertions.assertNotNull(requestBodySchema2.get$ref());
+ Assertions.assertEquals(requestBodySchema2.get$ref(), "#/components/schemas/updatePetWithForm_request");
Schema requestBodySchema3 = ModelUtils.getReferencedSchema(openAPI, requestBodySchema);
CodegenParameter codegenParameter = codegen.fromFormProperty("visitDate",
(Schema) requestBodySchema3.getProperties().get("visitDate"), new HashSet<>());
- Assert.assertEquals(codegenParameter.defaultValue, "1971-12-19T03:39:57-08:00");
- Assert.assertEquals(codegenParameter.getSchema(), null);
+ Assertions.assertEquals(codegenParameter.defaultValue, "1971-12-19T03:39:57-08:00");
+ Assertions.assertEquals(codegenParameter.getSchema(), null);
}
@Test
@@ -4415,7 +4415,7 @@ public void testObjectSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 9, logsList.size());
+ assertEquals(9, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
assertEquals("Validation 'minItems' has no effect on schema 'object'. Ignoring!", logsList.get(0)
.getMessage());
assertEquals("Validation 'maxItems' has no effect on schema 'object'. Ignoring!", logsList.get(1)
@@ -4464,7 +4464,7 @@ public void testStringSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 8, logsList.size());
+ assertEquals(8, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
assertEquals("Validation 'minItems' has no effect on schema 'string'. Ignoring!", logsList.get(0)
.getMessage());
assertEquals("Validation 'maxItems' has no effect on schema 'string'. Ignoring!", logsList.get(1)
@@ -4511,7 +4511,7 @@ public void testIntegerSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 8, logsList.size());
+ assertEquals(8, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
assertEquals("Validation 'minItems' has no effect on schema 'integer'. Ignoring!", logsList.get(0)
.getMessage());
assertEquals("Validation 'maxItems' has no effect on schema 'integer'. Ignoring!", logsList.get(1)
@@ -4558,7 +4558,7 @@ public void testAnySchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 0, logsList.size());
+ assertEquals(0, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
}
@Test
@@ -4586,7 +4586,7 @@ public void testBooleanSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 11, logsList.size());
+ assertEquals(11, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
assertEquals("Validation 'minItems' has no effect on schema 'boolean'. Ignoring!", logsList.get(0)
.getMessage());
assertEquals("Validation 'maxItems' has no effect on schema 'boolean'. Ignoring!", logsList.get(1)
@@ -4639,7 +4639,7 @@ public void testNullSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 0, logsList.size());
+ assertEquals(0, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
}
public static class FromParameter {
@@ -4679,7 +4679,7 @@ public void testConvertPropertyToBooleanAndWriteBack_Boolean_true() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, true);
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertTrue(result);
+ Assertions.assertTrue(result);
}
@Test
@@ -4688,7 +4688,7 @@ public void testConvertPropertyToBooleanAndWriteBack_Boolean_false() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, false);
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertFalse(result);
+ Assertions.assertFalse(result);
}
@Test
@@ -4697,7 +4697,7 @@ public void testConvertPropertyToBooleanAndWriteBack_String_true() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, "true");
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertTrue(result);
+ Assertions.assertTrue(result);
}
@Test
@@ -4706,7 +4706,7 @@ public void testConvertPropertyToBooleanAndWriteBack_String_false() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, "false");
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertFalse(result);
+ Assertions.assertFalse(result);
}
@Test
@@ -4715,7 +4715,7 @@ public void testConvertPropertyToBooleanAndWriteBack_String_blibb() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, "blibb");
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertFalse(result);
+ Assertions.assertFalse(result);
}
}
@@ -4740,16 +4740,16 @@ public void testFromPropertyRequiredAndOptional() {
modelName = "FooOptional";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel fooOptional = codegen.fromModel(modelName, sc);
- Assert.assertTrue(fooRequired.vars.get(0).required);
- Assert.assertEquals(fooRequired.vars.get(0).name, "foo");
+ Assertions.assertTrue(fooRequired.vars.get(0).required);
+ Assertions.assertEquals(fooRequired.vars.get(0).name, "foo");
- Assert.assertEquals(fooRequired.requiredVars.size(), 1);
- Assert.assertEquals(fooRequired.requiredVars.get(0).name, "foo");
- Assert.assertTrue(fooRequired.requiredVars.get(0).required);
+ Assertions.assertEquals(fooRequired.requiredVars.size(), 1);
+ Assertions.assertEquals(fooRequired.requiredVars.get(0).name, "foo");
+ Assertions.assertTrue(fooRequired.requiredVars.get(0).required);
- Assert.assertFalse(fooOptional.vars.get(0).required);
- Assert.assertEquals(fooOptional.vars.get(0).name, "foo");
- Assert.assertEquals(fooOptional.requiredVars.size(), 0);
+ Assertions.assertFalse(fooOptional.vars.get(0).required);
+ Assertions.assertEquals(fooOptional.vars.get(0).name, "foo");
+ Assertions.assertEquals(fooOptional.requiredVars.size(), 0);
}
@Test
@@ -4771,16 +4771,16 @@ public void testReferencedEnumType() {
CodegenModel modelWithReferencedSchema = codegen.fromModel(modelName, schemaWithReferencedEnum);
CodegenProperty referencedEnumSchemaProperty = modelWithReferencedSchema.vars.get(1);
- Assert.assertNotNull(schemaWithReferencedEnum);
- Assert.assertTrue(modelWithReferencedSchema.hasEnums);
- Assert.assertEquals(referencedEnumSchemaProperty.getName(), "enumType");
- Assert.assertFalse(referencedEnumSchemaProperty.isEnum);
- Assert.assertTrue(referencedEnumSchemaProperty.getIsEnumOrRef());
- Assert.assertTrue(referencedEnumSchemaProperty.isEnumRef);
- Assert.assertFalse(referencedEnumSchemaProperty.isInnerEnum);
- Assert.assertFalse(referencedEnumSchemaProperty.isString);
- Assert.assertFalse(referencedEnumSchemaProperty.isContainer);
- Assert.assertFalse(referencedEnumSchemaProperty.isPrimitiveType);
+ Assertions.assertNotNull(schemaWithReferencedEnum);
+ Assertions.assertTrue(modelWithReferencedSchema.hasEnums);
+ Assertions.assertEquals(referencedEnumSchemaProperty.getName(), "enumType");
+ Assertions.assertFalse(referencedEnumSchemaProperty.isEnum);
+ Assertions.assertTrue(referencedEnumSchemaProperty.getIsEnumOrRef());
+ Assertions.assertTrue(referencedEnumSchemaProperty.isEnumRef);
+ Assertions.assertFalse(referencedEnumSchemaProperty.isInnerEnum);
+ Assertions.assertFalse(referencedEnumSchemaProperty.isString);
+ Assertions.assertFalse(referencedEnumSchemaProperty.isContainer);
+ Assertions.assertFalse(referencedEnumSchemaProperty.isPrimitiveType);
}
@Test
@@ -4795,30 +4795,30 @@ public void testAllOfDefaultEnumType() {
CodegenModel modelWithReferencedSchema = codegen.fromModel(modelName, schemaWithReferencedEnum);
CodegenProperty defaultEnumSchemaProperty = modelWithReferencedSchema.vars.get(4);
- Assert.assertNotNull(schemaWithReferencedEnum);
- Assert.assertTrue(modelWithReferencedSchema.hasEnums);
- Assert.assertEquals(defaultEnumSchemaProperty.getName(), "defaultMinusnumberMinusenum");
- Assert.assertFalse(defaultEnumSchemaProperty.isEnum);
- Assert.assertTrue(defaultEnumSchemaProperty.getIsEnumOrRef());
- Assert.assertTrue(defaultEnumSchemaProperty.isEnumRef);
- Assert.assertFalse(defaultEnumSchemaProperty.isInnerEnum);
- Assert.assertFalse(defaultEnumSchemaProperty.isString);
- Assert.assertFalse(defaultEnumSchemaProperty.isContainer);
- Assert.assertFalse(defaultEnumSchemaProperty.isPrimitiveType);
- Assert.assertEquals(defaultEnumSchemaProperty.defaultValue, "2");
+ Assertions.assertNotNull(schemaWithReferencedEnum);
+ Assertions.assertTrue(modelWithReferencedSchema.hasEnums);
+ Assertions.assertEquals(defaultEnumSchemaProperty.getName(), "defaultMinusnumberMinusenum");
+ Assertions.assertFalse(defaultEnumSchemaProperty.isEnum);
+ Assertions.assertTrue(defaultEnumSchemaProperty.getIsEnumOrRef());
+ Assertions.assertTrue(defaultEnumSchemaProperty.isEnumRef);
+ Assertions.assertFalse(defaultEnumSchemaProperty.isInnerEnum);
+ Assertions.assertFalse(defaultEnumSchemaProperty.isString);
+ Assertions.assertFalse(defaultEnumSchemaProperty.isContainer);
+ Assertions.assertFalse(defaultEnumSchemaProperty.isPrimitiveType);
+ Assertions.assertEquals(defaultEnumSchemaProperty.defaultValue, "2");
// test allOf with a single sub-schema and no default value set in the top level
CodegenProperty allOfEnumSchemaProperty = modelWithReferencedSchema.vars.get(5);
- Assert.assertEquals(allOfEnumSchemaProperty.getName(), "allofMinusnumberMinusenum");
- Assert.assertFalse(allOfEnumSchemaProperty.isEnum);
- Assert.assertTrue(allOfEnumSchemaProperty.getIsEnumOrRef());
- Assert.assertTrue(allOfEnumSchemaProperty.isEnumRef);
- Assert.assertFalse(allOfEnumSchemaProperty.isInnerEnum);
- Assert.assertFalse(allOfEnumSchemaProperty.isString);
- Assert.assertFalse(allOfEnumSchemaProperty.isContainer);
- Assert.assertFalse(allOfEnumSchemaProperty.isPrimitiveType);
- Assert.assertTrue(allOfEnumSchemaProperty.deprecated);
- Assert.assertEquals(allOfEnumSchemaProperty.defaultValue, "null");
+ Assertions.assertEquals(allOfEnumSchemaProperty.getName(), "allofMinusnumberMinusenum");
+ Assertions.assertFalse(allOfEnumSchemaProperty.isEnum);
+ Assertions.assertTrue(allOfEnumSchemaProperty.getIsEnumOrRef());
+ Assertions.assertTrue(allOfEnumSchemaProperty.isEnumRef);
+ Assertions.assertFalse(allOfEnumSchemaProperty.isInnerEnum);
+ Assertions.assertFalse(allOfEnumSchemaProperty.isString);
+ Assertions.assertFalse(allOfEnumSchemaProperty.isContainer);
+ Assertions.assertFalse(allOfEnumSchemaProperty.isPrimitiveType);
+ Assertions.assertTrue(allOfEnumSchemaProperty.deprecated);
+ Assertions.assertEquals(allOfEnumSchemaProperty.defaultValue, "null");
}
@Test
@@ -4832,16 +4832,16 @@ public void testInlineEnumType() {
CodegenModel modelWithReferencedSchema = codegen.fromModel(modelName, schemaWithReferencedEnum);
CodegenProperty inlineEnumSchemaProperty = modelWithReferencedSchema.vars.get(1);
- Assert.assertNotNull(schemaWithReferencedEnum);
- Assert.assertTrue(modelWithReferencedSchema.hasEnums);
- Assert.assertEquals(inlineEnumSchemaProperty.getName(), "enumType");
- Assert.assertTrue(inlineEnumSchemaProperty.isEnum);
- Assert.assertTrue(inlineEnumSchemaProperty.isInnerEnum);
- Assert.assertFalse(inlineEnumSchemaProperty.isEnumRef);
- Assert.assertTrue(inlineEnumSchemaProperty.getIsEnumOrRef());
- Assert.assertTrue(inlineEnumSchemaProperty.isString);
- Assert.assertFalse(inlineEnumSchemaProperty.isContainer);
- Assert.assertFalse(inlineEnumSchemaProperty.isPrimitiveType);
+ Assertions.assertNotNull(schemaWithReferencedEnum);
+ Assertions.assertTrue(modelWithReferencedSchema.hasEnums);
+ Assertions.assertEquals(inlineEnumSchemaProperty.getName(), "enumType");
+ Assertions.assertTrue(inlineEnumSchemaProperty.isEnum);
+ Assertions.assertTrue(inlineEnumSchemaProperty.isInnerEnum);
+ Assertions.assertFalse(inlineEnumSchemaProperty.isEnumRef);
+ Assertions.assertTrue(inlineEnumSchemaProperty.getIsEnumOrRef());
+ Assertions.assertTrue(inlineEnumSchemaProperty.isString);
+ Assertions.assertFalse(inlineEnumSchemaProperty.isContainer);
+ Assertions.assertFalse(inlineEnumSchemaProperty.isPrimitiveType);
}
@Test
@@ -4853,7 +4853,7 @@ public void testAddOption() {
expected.setDefault("defaultValue");
expected.setEnum(Map.of("defaultValue", "defaultDesc"));
- Assert.assertTrue(codegen.cliOptions.contains(expected));
+ Assertions.assertTrue(codegen.cliOptions.contains(expected));
}
@Test
@@ -4863,7 +4863,7 @@ public void testAddOptionDefaultNull() {
CliOption expected = new CliOption("optionKey", "optionDesc");
- Assert.assertTrue(codegen.cliOptions.contains(expected));
+ Assertions.assertTrue(codegen.cliOptions.contains(expected));
}
@Test
@@ -4874,7 +4874,7 @@ public void testAddOptionEnumValuesNull() {
CliOption expected = new CliOption("optionKey", "optionDesc");
expected.setDefault("defaultValue");
- Assert.assertTrue(codegen.cliOptions.contains(expected));
+ Assertions.assertTrue(codegen.cliOptions.contains(expected));
}
@Test
@@ -4897,8 +4897,8 @@ public void testRequestInlineSingleExample() {
@Test
void testIsXML() {
final DefaultCodegen codegen = new DefaultCodegen();
- Assert.assertTrue(codegen.isXmlMimeType("application/xml"));
- Assert.assertTrue(codegen.isXmlMimeType("application/rss+xml"));
+ Assertions.assertTrue(codegen.isXmlMimeType("application/xml"));
+ Assertions.assertTrue(codegen.isXmlMimeType("application/rss+xml"));
}
@Test
@@ -4910,8 +4910,8 @@ public void testWebhooks() throws IOException {
Operation operation = openAPI.getWebhooks().get("newPet").getPost();
CodegenOperation co = codegen.fromOperation("newPet", "get", operation, null);
- Assert.assertEquals(co.path, "/newPet");
- Assert.assertEquals(co.operationId, "newPetGet");
+ Assertions.assertEquals(co.path, "/newPet");
+ Assertions.assertEquals(co.operationId, "newPetGet");
}
@Test
@@ -4934,5 +4934,4 @@ public void testAllVars_issue_18340() {
CodegenModel springCat2 = springCodegen.fromModel("Cat2", cat2Model);
assertThat(getNames(springCat2.allVars)).isEqualTo(List.of("petType", "name"));
}
-
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/AbstractGeneratorsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/AbstractGeneratorsTest.java
new file mode 100644
index 000000000000..d8e7da91e1b4
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/AbstractGeneratorsTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.cpppistache;
+
+import java.io.*;
+import java.nio.file.Files;
+import java.util.*;
+
+import org.openapitools.codegen.*;
+import org.openapitools.codegen.config.CodegenConfigurator;
+
+/**
+ * Abstract test class to make one or multiple generators generate files for one specific input spec
+ */
+public abstract class AbstractGeneratorsTest {
+ /**
+ * Test each with a given input spec
+ * @param inputSpec The input spec to use
+ * @return Map of generator and files
+ * @throws IOException if the test directory cannot be created
+ */
+ protected Map> eachWith(String inputSpec) throws IOException {
+ Objects.requireNonNull(inputSpec, "Specify an inputspec to run that test");
+ Map> generatedFilesByGenerator = new HashMap<>();
+
+ for (final CodegenConfig codegenConfig : CodegenConfigLoader.getAll()) {
+ generatedFilesByGenerator.put(codegenConfig.getName(), oneWith(codegenConfig.getName(), inputSpec));
+ }
+
+ return generatedFilesByGenerator;
+ }
+
+ /**
+ * Test each with a given input spec
+ * @param generatorName the generator name to use
+ * @param inputSpec The input spec to use
+ * @return List of generated files
+ * @throws IOException if the test directory cannot be created
+ */
+ protected List oneWith(String generatorName, String inputSpec) throws IOException {
+ Objects.requireNonNull(generatorName, "Specify a generatorName to run that test");
+ Objects.requireNonNull(inputSpec, "Specify an inputspec to run that test");
+
+ File output = Files.createTempDirectory("test").toFile();
+ output.deleteOnExit();
+
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName(generatorName)
+ .setInputSpec(inputSpec)
+ .setOutputDir(output.getAbsolutePath().replace("\\", "/"));
+
+ final ClientOptInput clientOptInput = configurator.toClientOptInput();
+ DefaultGenerator generator = new DefaultGenerator();
+ return generator.opts(clientOptInput).generate();
+ }
+}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/ObjectAnyTypeSetTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/ObjectAnyTypeSetTest.java
new file mode 100644
index 000000000000..95b2ddddcb59
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/ObjectAnyTypeSetTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.cpppistache;
+
+import java.io.*;
+import java.util.*;
+
+import org.slf4j.*;
+import org.testng.annotations.Test;
+import org.testng.asserts.SoftAssert;
+
+/**
+ * Generate from an input spec containing various abstract objects and sets
+ */
+public class ObjectAnyTypeSetTest extends AbstractGeneratorsTest {
+ /** Logger. */
+ private static final Logger LOGGER = LoggerFactory.getLogger(ObjectAnyTypeSetTest.class);
+
+ /** A Petstore inputspec with abstract properties added in the Pet */
+ private static final String INPUT_SPEC = "src/test/resources/3_0/issues-anytype-object-set-petstore-everything.yaml";
+
+ /** Soft assert to check all the generators before eventually failing a test */
+ private final SoftAssert softAssert = new SoftAssert();
+
+ /**
+ * Test some generators with an input spec requiring generation of abstract properties
+ * @throws IOException if the test folder cannot be created
+ */
+ @Test
+ public void testSomeWithPetstoreWithAbstract() throws IOException {
+// assertGeneratedFiles("c");
+// assertGeneratedFiles("cpp-restsdk");
+ generateFiles("cpp-pistache-server");
+// assertGeneratedFiles("typescript");
+ this.softAssert.assertAll();
+ }
+
+ /**
+ * Asserts that a generator has produced some files
+ * @param generatorName The generator name to test
+ * @return List of files generated
+ * @throws IOException if the test folder cannot be created
+ */
+ private List generateFiles(String generatorName) throws IOException {
+ Objects.requireNonNull(generatorName, "A generator name is expected for this assertion");
+ return oneWith(generatorName, INPUT_SPEC);
+ }
+}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/README.md b/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/README.md
new file mode 100644
index 000000000000..23af1c6b581b
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/cpppistache/README.md
@@ -0,0 +1,2 @@
+These test aren't useful yet
+they only run the generator for a single case
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java
index 9fe394f32949..8ee09093d5af 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java
@@ -16,9 +16,8 @@
package org.openapitools.codegen.csharpnetcore;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.openapitools.codegen.TestUtils.assertFileContains;
-import static org.openapitools.codegen.TestUtils.assertFileExists;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema;
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientDeepObjectTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientDeepObjectTest.java
index bfacb03a4729..06ad440844f4 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientDeepObjectTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientDeepObjectTest.java
@@ -32,7 +32,7 @@
import java.nio.file.Files;
import java.nio.file.Paths;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.openapitools.codegen.TestUtils.assertFileContains;
public class CSharpClientDeepObjectTest {
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 0feb5694a299..de42f49f0ba8 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
@@ -17,12 +17,11 @@
package org.openapitools.codegen.java;
-import static org.junit.Assert.assertNotNull;
+import org.junit.jupiter.api.Assertions;
import static org.openapitools.codegen.TestUtils.assertFileContains;
import static org.openapitools.codegen.TestUtils.assertFileNotContains;
import static org.openapitools.codegen.TestUtils.validateJavaSourceFiles;
import static org.openapitools.codegen.languages.JavaClientCodegen.USE_ENUM_CASE_INSENSITIVE;
-import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_BUILDERS;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
@@ -110,9 +109,9 @@ public void arraysInRequestBody() {
"application/json",
new MediaType().schema(new ArraySchema().items(new StringSchema()))));
CodegenParameter codegenParameter1 = codegen.fromRequestBody(body1, new HashSet(), null);
- Assert.assertEquals(codegenParameter1.description, "A list of ids");
- Assert.assertEquals(codegenParameter1.dataType, "List");
- Assert.assertEquals(codegenParameter1.baseType, "String");
+ Assertions.assertEquals(codegenParameter1.description, "A list of ids");
+ Assertions.assertEquals(codegenParameter1.dataType, "List");
+ Assertions.assertEquals(codegenParameter1.baseType, "String");
RequestBody body2 = new RequestBody();
body2.setDescription("A list of list of values");
@@ -124,9 +123,9 @@ public void arraysInRequestBody() {
.schema(
new ArraySchema().items(new ArraySchema().items(new IntegerSchema())))));
CodegenParameter codegenParameter2 = codegen.fromRequestBody(body2, new HashSet(), null);
- Assert.assertEquals(codegenParameter2.description, "A list of list of values");
- Assert.assertEquals(codegenParameter2.dataType, "List>");
- Assert.assertEquals(codegenParameter2.baseType, "List");
+ Assertions.assertEquals(codegenParameter2.description, "A list of list of values");
+ Assertions.assertEquals(codegenParameter2.dataType, "List>");
+ Assertions.assertEquals(codegenParameter2.baseType, "List");
RequestBody body3 = new RequestBody();
body3.setDescription("A list of points");
@@ -143,9 +142,9 @@ public void arraysInRequestBody() {
point.addProperty("x", new IntegerSchema().format(SchemaTypeUtil.INTEGER32_FORMAT));
point.addProperty("y", new IntegerSchema().format(SchemaTypeUtil.INTEGER32_FORMAT));
CodegenParameter codegenParameter3 = codegen.fromRequestBody(body3, new HashSet(), null);
- Assert.assertEquals(codegenParameter3.description, "A list of points");
- Assert.assertEquals(codegenParameter3.dataType, "List");
- Assert.assertEquals(codegenParameter3.baseType, "Point");
+ Assertions.assertEquals(codegenParameter3.description, "A list of points");
+ Assertions.assertEquals(codegenParameter3.dataType, "List");
+ Assertions.assertEquals(codegenParameter3.baseType, "Point");
}
@Test
@@ -154,7 +153,7 @@ public void nullValuesInComposedSchema() {
ComposedSchema schema = new ComposedSchema();
CodegenModel result = codegen.fromModel("CompSche",
schema);
- Assert.assertEquals(result.name, "CompSche");
+ Assertions.assertEquals(result.name, "CompSche");
}
@Test
@@ -178,7 +177,7 @@ public void testParametersAreCorrectlyOrderedWhenUsingRetrofit() {
javaClientCodegen.postProcessOperationsWithModels(objs, Collections.emptyList());
- Assert.assertEquals(Arrays.asList(pathParam1, pathParam2, queryParamRequired, queryParamOptional), codegenOperation.allParams);
+ Assertions.assertEquals(Arrays.asList(pathParam1, pathParam2, queryParamRequired, queryParamOptional), codegenOperation.allParams);
}
@Test
@@ -186,22 +185,22 @@ public void testInitialConfigValues() throws Exception {
final JavaClientCodegen codegen = new JavaClientCodegen();
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
- Assert.assertFalse(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
+ Assertions.assertFalse(codegen.isHideGenerationTimestamp());
- Assert.assertEquals(codegen.modelPackage(), "org.openapitools.client.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.modelPackage(), "org.openapitools.client.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"org.openapitools.client.model");
- Assert.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE),
"org.openapitools.client.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "org.openapitools.client");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "org.openapitools.client");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"org.openapitools.client");
- Assert.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON);
+ Assertions.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON);
}
@Test
@@ -214,20 +213,20 @@ public void testSettersForConfigValues() throws Exception {
codegen.setSerializationLibrary("JACKSON");
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
- Assert.assertTrue(codegen.isHideGenerationTimestamp());
- Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
+ Assertions.assertTrue(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"xyz.yyyyy.zzzzzzz.model");
- Assert.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "xyz.yyyyy.zzzzzzz.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.invoker");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.invoker");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"xyz.yyyyy.zzzzzzz.invoker");
- Assert.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON); // the library JavaClientCodegen.OKHTTP_GSON only supports GSON
+ Assertions.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON); // the library JavaClientCodegen.OKHTTP_GSON only supports GSON
}
@Test
@@ -245,21 +244,21 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception {
codegen.additionalProperties().put(CodegenConstants.LIBRARY, JavaClientCodegen.JERSEY2);
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
- Assert.assertTrue(codegen.isHideGenerationTimestamp());
- Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
+ Assertions.assertTrue(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.aaaaa.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.aaaaa.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE),
"xyz.yyyyy.zzzzzzz.aaaaa.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.iiii.invoker");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.iiii.invoker");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"xyz.yyyyy.zzzzzzz.iiii.invoker");
- Assert.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON);
+ Assertions.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON);
}
@Test
@@ -322,7 +321,7 @@ public void testSupportedSecuritySchemesJersey() throws Exception {
codegen.additionalProperties().put(CodegenConstants.LIBRARY, JavaClientCodegen.JERSEY3);
codegen.processOpts();
- Assert.assertTrue(codegen.getFeatureSet().getSecurityFeatures().contains(SecurityFeature.SignatureAuth));
+ Assertions.assertTrue(codegen.getFeatureSet().getSecurityFeatures().contains(SecurityFeature.SignatureAuth));
}
@Test
@@ -334,16 +333,16 @@ public void testPackageNamesSetInvokerDerivedFromApi() {
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.yyyyy.zzzzzzz.aaaaa.api");
codegen.processOpts();
- Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.aaaaa.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.aaaaa.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE),
"xyz.yyyyy.zzzzzzz.aaaaa.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.aaaaa");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.aaaaa");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"xyz.yyyyy.zzzzzzz.aaaaa");
}
@@ -356,16 +355,16 @@ public void testPackageNamesSetInvokerDerivedFromModel() {
.put(CodegenConstants.MODEL_PACKAGE, "xyz.yyyyy.zzzzzzz.mmmmm.model");
codegen.processOpts();
- Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE),
"org.openapitools.client.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.mmmmm");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.mmmmm");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"xyz.yyyyy.zzzzzzz.mmmmm");
}
@@ -378,8 +377,8 @@ public void testGetSchemaTypeWithComposedSchemaWithAllOf() {
Operation operation = openAPI.getPaths().get("/ping").getPost();
CodegenOperation co = codegen.fromOperation("/ping", "POST", operation, null);
- Assert.assertEquals(co.allParams.size(), 1);
- Assert.assertEquals(co.allParams.get(0).baseType, "MessageEventCoreWithTimeListEntries");
+ Assertions.assertEquals(co.allParams.size(), 1);
+ Assertions.assertEquals(co.allParams.get(0).baseType, "MessageEventCoreWithTimeListEntries");
}
@Test
@@ -391,11 +390,11 @@ public void updateCodegenPropertyEnum() {
List> enumVars =
(List>) array.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars);
Map testedEnumVar = enumVars.get(0);
- Assert.assertNotNull(testedEnumVar);
- Assert.assertEquals(testedEnumVar.getOrDefault("name", ""), "NUMBER_1");
- Assert.assertEquals(testedEnumVar.getOrDefault("value", ""), "1");
+ Assertions.assertNotNull(testedEnumVar);
+ Assertions.assertEquals(testedEnumVar.getOrDefault("name", ""), "NUMBER_1");
+ Assertions.assertEquals(testedEnumVar.getOrDefault("value", ""), "1");
}
@Test
@@ -411,11 +410,11 @@ public void updateCodegenPropertyEnumWithCustomNames() {
List> enumVars =
(List>) array.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars);
Map testedEnumVar = enumVars.get(0);
- Assert.assertNotNull(testedEnumVar);
- Assert.assertEquals(testedEnumVar.getOrDefault("name", ""), "ONE");
- Assert.assertEquals(testedEnumVar.getOrDefault("value", ""), "1");
+ Assertions.assertNotNull(testedEnumVar);
+ Assertions.assertEquals(testedEnumVar.getOrDefault("name", ""), "ONE");
+ Assertions.assertEquals(testedEnumVar.getOrDefault("value", ""), "1");
}
@Test
@@ -436,7 +435,7 @@ public void testGeneratePing() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 40);
+ Assertions.assertEquals(files.size(), 40);
TestUtils.ensureContainsFile(files, output, ".gitignore");
TestUtils.ensureContainsFile(files, output, ".openapi-generator-ignore");
TestUtils.ensureContainsFile(files, output, ".openapi-generator/FILES");
@@ -512,7 +511,7 @@ public void testGeneratePingSomeObj() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 43);
+ Assertions.assertEquals(files.size(), 43);
TestUtils.ensureContainsFile(files, output, ".gitignore");
TestUtils.ensureContainsFile(files, output, ".openapi-generator-ignore");
TestUtils.ensureContainsFile(files, output, ".openapi-generator/FILES");
@@ -600,7 +599,7 @@ public void testJdkHttpClient() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 32);
+ Assertions.assertEquals(files.size(), 32);
validateJavaSourceFiles(files);
TestUtils.assertFileContains(
@@ -669,7 +668,7 @@ public void testJdkHttpClientWithAndWithoutDiscriminator() throws Exception {
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 153);
+ Assertions.assertEquals(files.size(), 153);
validateJavaSourceFiles(files);
TestUtils.assertFileContains(Paths.get(output + "/src/main/java/xyz/abcdef/model/Dog.java"),
@@ -696,7 +695,7 @@ public void testJdkHttpAsyncClient() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 35);
+ Assertions.assertEquals(files.size(), 35);
validateJavaSourceFiles(files);
Path defaultApi = Paths.get(output + "/src/main/java/xyz/abcdef/api/PingApi.java");
@@ -723,10 +722,10 @@ public void testReferencedHeader() {
ApiResponse ok_200 = openAPI.getComponents().getResponses().get("OK_200");
CodegenResponse response = codegen.fromResponse("200", ok_200);
- Assert.assertEquals(response.headers.size(), 1);
+ Assertions.assertEquals(response.headers.size(), 1);
CodegenProperty header = response.headers.get(0);
- Assert.assertEquals(header.dataType, "UUID");
- Assert.assertEquals(header.baseName, "Request");
+ Assertions.assertEquals(header.dataType, "UUID");
+ Assertions.assertEquals(header.baseName, "Request");
}
@Test
@@ -792,7 +791,7 @@ public void testAuthorizationScopeValues_Issue6733() throws IOException {
validateJavaSourceFiles(files);
- Assert.assertEquals(files.size(), 1);
+ Assertions.assertEquals(files.size(), 1);
files.forEach(File::deleteOnExit);
}
@@ -821,7 +820,7 @@ public void testTypedAndNonTypedComposedSchemaGeneration_3_1() throws IOExceptio
validateJavaSourceFiles(files);
- Assert.assertEquals(files.size(), 9);
+ Assertions.assertEquals(files.size(), 9);
files.forEach(File::deleteOnExit);
}
@@ -900,29 +899,29 @@ public void testFreeFormObjects() {
Schema test1 = openAPI.getComponents().getSchemas().get("MapTest1");
codegen.setOpenAPI(openAPI);
CodegenModel cm1 = codegen.fromModel("MapTest1", test1);
- Assert.assertEquals(cm1.getDataType(), "Map");
- Assert.assertEquals(cm1.getParent(), "HashMap");
- Assert.assertEquals(cm1.getClassname(), "MapTest1");
+ Assertions.assertEquals(cm1.getDataType(), "Map");
+ Assertions.assertEquals(cm1.getParent(), "HashMap");
+ Assertions.assertEquals(cm1.getClassname(), "MapTest1");
Schema test2 = openAPI.getComponents().getSchemas().get("MapTest2");
codegen.setOpenAPI(openAPI);
CodegenModel cm2 = codegen.fromModel("MapTest2", test2);
- Assert.assertEquals(cm2.getDataType(), "Map");
- Assert.assertEquals(cm2.getParent(), "HashMap");
- Assert.assertEquals(cm2.getClassname(), "MapTest2");
+ Assertions.assertEquals(cm2.getDataType(), "Map");
+ Assertions.assertEquals(cm2.getParent(), "HashMap");
+ Assertions.assertEquals(cm2.getClassname(), "MapTest2");
Schema test3 = openAPI.getComponents().getSchemas().get("MapTest3");
codegen.setOpenAPI(openAPI);
CodegenModel cm3 = codegen.fromModel("MapTest3", test3);
- Assert.assertEquals(cm3.getDataType(), "Map");
- Assert.assertEquals(cm3.getParent(), "HashMap");
- Assert.assertEquals(cm3.getClassname(), "MapTest3");
+ Assertions.assertEquals(cm3.getDataType(), "Map");
+ Assertions.assertEquals(cm3.getParent(), "HashMap");
+ Assertions.assertEquals(cm3.getClassname(), "MapTest3");
Schema other = openAPI.getComponents().getSchemas().get("OtherObj");
codegen.setOpenAPI(openAPI);
CodegenModel cm = codegen.fromModel("OtherObj", other);
- Assert.assertEquals(cm.getDataType(), "Object");
- Assert.assertEquals(cm.getClassname(), "OtherObj");
+ Assertions.assertEquals(cm.getDataType(), "Object");
+ Assertions.assertEquals(cm.getClassname(), "OtherObj");
}
/**
@@ -950,7 +949,7 @@ public void testSchemaMapping() throws IOException {
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
- Assert.assertEquals(
+ Assertions.assertEquals(
clientOptInput.getConfig().schemaMapping().get("TypeAlias"), "foo.bar.TypeAlias");
DefaultGenerator generator = new DefaultGenerator();
@@ -965,7 +964,7 @@ public void testSchemaMapping() throws IOException {
validateJavaSourceFiles(files);
- Assert.assertEquals(files.size(), 1);
+ Assertions.assertEquals(files.size(), 1);
TestUtils.ensureContainsFile(
files, output, "src/main/java/org/openapitools/client/model/ParentType.java");
@@ -980,11 +979,11 @@ public void testSchemaMapping() throws IOException {
final Pattern FIELD_PATTERN = Pattern.compile(".* private (.*?) typeAlias;.*", Pattern.DOTALL);
Matcher fieldMatcher = FIELD_PATTERN.matcher(parentTypeContents);
- Assert.assertTrue(fieldMatcher.matches());
+ Assertions.assertTrue(fieldMatcher.matches());
// this is the type of the field 'typeAlias'. With a working schemaMapping it should
// be 'foo.bar.TypeAlias' or just 'TypeAlias'
- Assert.assertEquals(fieldMatcher.group(1), "foo.bar.TypeAlias");
+ Assertions.assertEquals(fieldMatcher.group(1), "foo.bar.TypeAlias");
}
@Test
@@ -994,10 +993,10 @@ public void testBearerAuth() {
JavaClientCodegen codegen = new JavaClientCodegen();
List security = codegen.fromSecurity(openAPI.getComponents().getSecuritySchemes());
- Assert.assertEquals(security.size(), 1);
- Assert.assertEquals(security.get(0).isBasic, Boolean.TRUE);
- Assert.assertEquals(security.get(0).isBasicBasic, Boolean.FALSE);
- Assert.assertEquals(security.get(0).isBasicBearer, Boolean.TRUE);
+ Assertions.assertEquals(security.size(), 1);
+ Assertions.assertEquals(security.get(0).isBasic, Boolean.TRUE);
+ Assertions.assertEquals(security.get(0).isBasicBasic, Boolean.FALSE);
+ Assertions.assertEquals(security.get(0).isBasicBearer, Boolean.TRUE);
}
private CodegenProperty codegenPropertyWithArrayOfIntegerValues() {
@@ -1050,135 +1049,135 @@ public void testAnyType() {
Schema test1 = openAPI.getComponents().getSchemas().get("AnyValueModel");
codegen.setOpenAPI(openAPI);
CodegenModel cm1 = codegen.fromModel("AnyValueModel", test1);
- Assert.assertEquals(cm1.getClassname(), "AnyValueModel");
+ Assertions.assertEquals(cm1.getClassname(), "AnyValueModel");
final CodegenProperty property1 = cm1.allVars.get(0);
- Assert.assertEquals(property1.baseName, "any_value");
- Assert.assertEquals(property1.dataType, "Object");
- Assert.assertTrue(property1.isPrimitiveType);
- Assert.assertFalse(property1.isContainer);
- Assert.assertFalse(property1.isFreeFormObject);
- Assert.assertTrue(property1.isAnyType);
+ Assertions.assertEquals(property1.baseName, "any_value");
+ Assertions.assertEquals(property1.dataType, "Object");
+ Assertions.assertTrue(property1.isPrimitiveType);
+ Assertions.assertFalse(property1.isContainer);
+ Assertions.assertFalse(property1.isFreeFormObject);
+ Assertions.assertTrue(property1.isAnyType);
final CodegenProperty property2 = cm1.allVars.get(1);
- Assert.assertEquals(property2.baseName, "any_value_with_desc");
- Assert.assertEquals(property2.dataType, "Object");
- Assert.assertFalse(property2.required);
- Assert.assertTrue(property2.isPrimitiveType);
- Assert.assertFalse(property2.isContainer);
- Assert.assertFalse(property2.isFreeFormObject);
- Assert.assertTrue(property2.isAnyType);
+ Assertions.assertEquals(property2.baseName, "any_value_with_desc");
+ Assertions.assertEquals(property2.dataType, "Object");
+ Assertions.assertFalse(property2.required);
+ Assertions.assertTrue(property2.isPrimitiveType);
+ Assertions.assertFalse(property2.isContainer);
+ Assertions.assertFalse(property2.isFreeFormObject);
+ Assertions.assertTrue(property2.isAnyType);
final CodegenProperty property3 = cm1.allVars.get(2);
- Assert.assertEquals(property3.baseName, "any_value_nullable");
- Assert.assertEquals(property3.dataType, "Object");
- Assert.assertFalse(property3.required);
- Assert.assertTrue(property3.isPrimitiveType);
- Assert.assertFalse(property3.isContainer);
- Assert.assertFalse(property3.isFreeFormObject);
- Assert.assertTrue(property3.isAnyType);
+ Assertions.assertEquals(property3.baseName, "any_value_nullable");
+ Assertions.assertEquals(property3.dataType, "Object");
+ Assertions.assertFalse(property3.required);
+ Assertions.assertTrue(property3.isPrimitiveType);
+ Assertions.assertFalse(property3.isContainer);
+ Assertions.assertFalse(property3.isFreeFormObject);
+ Assertions.assertTrue(property3.isAnyType);
Schema test2 = openAPI.getComponents().getSchemas().get("AnyValueModelInline");
codegen.setOpenAPI(openAPI);
CodegenModel cm2 = codegen.fromModel("AnyValueModelInline", test2);
- Assert.assertEquals(cm2.getClassname(), "AnyValueModelInline");
+ Assertions.assertEquals(cm2.getClassname(), "AnyValueModelInline");
final CodegenProperty cp1 = cm2.vars.get(0);
- Assert.assertEquals(cp1.baseName, "any_value");
- Assert.assertEquals(cp1.dataType, "Object");
- Assert.assertFalse(cp1.required);
- Assert.assertTrue(cp1.isPrimitiveType);
- Assert.assertFalse(cp1.isContainer);
- Assert.assertFalse(cp1.isFreeFormObject);
- Assert.assertTrue(cp1.isAnyType);
+ Assertions.assertEquals(cp1.baseName, "any_value");
+ Assertions.assertEquals(cp1.dataType, "Object");
+ Assertions.assertFalse(cp1.required);
+ Assertions.assertTrue(cp1.isPrimitiveType);
+ Assertions.assertFalse(cp1.isContainer);
+ Assertions.assertFalse(cp1.isFreeFormObject);
+ Assertions.assertTrue(cp1.isAnyType);
final CodegenProperty cp2 = cm2.vars.get(1);
- Assert.assertEquals(cp2.baseName, "any_value_with_desc");
- Assert.assertEquals(cp2.dataType, "Object");
- Assert.assertFalse(cp2.required);
- Assert.assertTrue(cp2.isPrimitiveType);
- Assert.assertFalse(cp2.isContainer);
- Assert.assertFalse(cp2.isFreeFormObject);
- Assert.assertTrue(cp2.isAnyType);
+ Assertions.assertEquals(cp2.baseName, "any_value_with_desc");
+ Assertions.assertEquals(cp2.dataType, "Object");
+ Assertions.assertFalse(cp2.required);
+ Assertions.assertTrue(cp2.isPrimitiveType);
+ Assertions.assertFalse(cp2.isContainer);
+ Assertions.assertFalse(cp2.isFreeFormObject);
+ Assertions.assertTrue(cp2.isAnyType);
final CodegenProperty cp3 = cm2.vars.get(2);
- Assert.assertEquals(cp3.baseName, "any_value_nullable");
- Assert.assertEquals(cp3.dataType, "Object");
- Assert.assertFalse(cp3.required);
- Assert.assertTrue(cp3.isPrimitiveType);
- Assert.assertFalse(cp3.isContainer);
- Assert.assertFalse(cp3.isFreeFormObject);
- Assert.assertTrue(cp3.isAnyType);
+ Assertions.assertEquals(cp3.baseName, "any_value_nullable");
+ Assertions.assertEquals(cp3.dataType, "Object");
+ Assertions.assertFalse(cp3.required);
+ Assertions.assertTrue(cp3.isPrimitiveType);
+ Assertions.assertFalse(cp3.isContainer);
+ Assertions.assertFalse(cp3.isFreeFormObject);
+ Assertions.assertTrue(cp3.isAnyType);
// map
// Should allow in any type including map, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp4 = cm2.vars.get(3);
- Assert.assertEquals(cp4.baseName, "map_free_form_object");
- Assert.assertEquals(cp4.dataType, "Map");
- Assert.assertFalse(cp4.required);
- Assert.assertTrue(cp4.isPrimitiveType);
- Assert.assertTrue(cp4.isContainer);
- Assert.assertTrue(cp4.isMap);
- Assert.assertTrue(cp4.isFreeFormObject);
- Assert.assertFalse(cp4.isAnyType);
- Assert.assertFalse(cp4.isModel);
+ Assertions.assertEquals(cp4.baseName, "map_free_form_object");
+ Assertions.assertEquals(cp4.dataType, "Map");
+ Assertions.assertFalse(cp4.required);
+ Assertions.assertTrue(cp4.isPrimitiveType);
+ Assertions.assertTrue(cp4.isContainer);
+ Assertions.assertTrue(cp4.isMap);
+ Assertions.assertTrue(cp4.isFreeFormObject);
+ Assertions.assertFalse(cp4.isAnyType);
+ Assertions.assertFalse(cp4.isModel);
// Should allow in any type including map, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp5 = cm2.vars.get(4);
- Assert.assertEquals(cp5.baseName, "map_any_value_with_desc");
- Assert.assertEquals(cp5.dataType, "Map");
- Assert.assertFalse(cp5.required);
- Assert.assertTrue(cp5.isPrimitiveType);
- Assert.assertTrue(cp5.isContainer);
- Assert.assertTrue(cp5.isMap);
- Assert.assertTrue(cp5.isFreeFormObject);
- Assert.assertFalse(cp5.isAnyType);
- Assert.assertFalse(cp5.isModel);
+ Assertions.assertEquals(cp5.baseName, "map_any_value_with_desc");
+ Assertions.assertEquals(cp5.dataType, "Map");
+ Assertions.assertFalse(cp5.required);
+ Assertions.assertTrue(cp5.isPrimitiveType);
+ Assertions.assertTrue(cp5.isContainer);
+ Assertions.assertTrue(cp5.isMap);
+ Assertions.assertTrue(cp5.isFreeFormObject);
+ Assertions.assertFalse(cp5.isAnyType);
+ Assertions.assertFalse(cp5.isModel);
// Should allow in any type including map, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp6 = cm2.vars.get(5);
- Assert.assertEquals(cp6.baseName, "map_any_value_nullable");
- Assert.assertEquals(cp6.dataType, "Map");
- Assert.assertFalse(cp6.required);
- Assert.assertTrue(cp6.isPrimitiveType);
- Assert.assertTrue(cp6.isContainer);
- Assert.assertTrue(cp6.isMap);
- Assert.assertTrue(cp6.isFreeFormObject);
- Assert.assertFalse(cp6.isAnyType);
+ Assertions.assertEquals(cp6.baseName, "map_any_value_nullable");
+ Assertions.assertEquals(cp6.dataType, "Map");
+ Assertions.assertFalse(cp6.required);
+ Assertions.assertTrue(cp6.isPrimitiveType);
+ Assertions.assertTrue(cp6.isContainer);
+ Assertions.assertTrue(cp6.isMap);
+ Assertions.assertTrue(cp6.isFreeFormObject);
+ Assertions.assertFalse(cp6.isAnyType);
// array
// Should allow in any type including array, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp7 = cm2.vars.get(6);
- Assert.assertEquals(cp7.baseName, "array_any_value");
- Assert.assertEquals(cp7.dataType, "List");
- Assert.assertFalse(cp7.required);
- Assert.assertTrue(cp7.isPrimitiveType);
- Assert.assertTrue(cp7.isContainer);
- Assert.assertTrue(cp7.isArray);
- Assert.assertFalse(cp7.isFreeFormObject);
- Assert.assertFalse(cp7.isAnyType);
+ Assertions.assertEquals(cp7.baseName, "array_any_value");
+ Assertions.assertEquals(cp7.dataType, "List");
+ Assertions.assertFalse(cp7.required);
+ Assertions.assertTrue(cp7.isPrimitiveType);
+ Assertions.assertTrue(cp7.isContainer);
+ Assertions.assertTrue(cp7.isArray);
+ Assertions.assertFalse(cp7.isFreeFormObject);
+ Assertions.assertFalse(cp7.isAnyType);
// Should allow in any type including array, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp8 = cm2.vars.get(7);
- Assert.assertEquals(cp8.baseName, "array_any_value_with_desc");
- Assert.assertEquals(cp8.dataType, "List");
- Assert.assertFalse(cp8.required);
- Assert.assertTrue(cp8.isPrimitiveType);
- Assert.assertTrue(cp8.isContainer);
- Assert.assertTrue(cp8.isArray);
- Assert.assertFalse(cp8.isFreeFormObject);
- Assert.assertFalse(cp8.isAnyType);
+ Assertions.assertEquals(cp8.baseName, "array_any_value_with_desc");
+ Assertions.assertEquals(cp8.dataType, "List");
+ Assertions.assertFalse(cp8.required);
+ Assertions.assertTrue(cp8.isPrimitiveType);
+ Assertions.assertTrue(cp8.isContainer);
+ Assertions.assertTrue(cp8.isArray);
+ Assertions.assertFalse(cp8.isFreeFormObject);
+ Assertions.assertFalse(cp8.isAnyType);
// Should allow in any type including array, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp9 = cm2.vars.get(8);
- Assert.assertEquals(cp9.baseName, "array_any_value_nullable");
- Assert.assertEquals(cp9.dataType, "List");
- Assert.assertFalse(cp9.required);
- Assert.assertTrue(cp9.isPrimitiveType);
- Assert.assertTrue(cp9.isContainer);
- Assert.assertTrue(cp9.isArray);
- Assert.assertFalse(cp9.isFreeFormObject);
- Assert.assertFalse(cp9.isAnyType);
+ Assertions.assertEquals(cp9.baseName, "array_any_value_nullable");
+ Assertions.assertEquals(cp9.dataType, "List");
+ Assertions.assertFalse(cp9.required);
+ Assertions.assertTrue(cp9.isPrimitiveType);
+ Assertions.assertTrue(cp9.isContainer);
+ Assertions.assertTrue(cp9.isArray);
+ Assertions.assertFalse(cp9.isFreeFormObject);
+ Assertions.assertFalse(cp9.isAnyType);
}
/**
@@ -1330,7 +1329,7 @@ public void testAllowModelWithNoProperties() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 49);
+ Assertions.assertEquals(files.size(), 49);
TestUtils.ensureContainsFile(
files, output, "src/main/java/org/openapitools/client/model/RealCommand.java");
TestUtils.ensureContainsFile(
@@ -1625,7 +1624,7 @@ public void testNativeClientWhiteSpacePathParamEncoding() throws IOException {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 35);
+ Assertions.assertEquals(files.size(), 35);
validateJavaSourceFiles(files);
TestUtils.assertFileContains(
@@ -1656,7 +1655,7 @@ public void testNativeClientExplodedQueryParamObject() throws IOException {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 38);
+ Assertions.assertEquals(files.size(), 38);
validateJavaSourceFiles(files);
TestUtils.assertFileContains(
@@ -1901,38 +1900,6 @@ public void testMicroprofileGenerateCorrectJsonbCreator_issue12622() throws Exce
.containsWithNameAndAttributes("JsonbProperty", ImmutableMap.of("value", "\"c\""));
}
- @Test
- public void testMicroprofileGenerateCorrectJacksonGenerator_issue18336() throws Exception {
- Map properties = new HashMap<>();
- properties.put(JavaClientCodegen.MICROPROFILE_REST_CLIENT_VERSION, "3.0");
- properties.put(CodegenConstants.SERIALIZATION_LIBRARY, JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON);
-
- File output = Files.createTempDirectory("test").toFile();
- output.deleteOnExit();
-
- final CodegenConfigurator configurator = new CodegenConfigurator()
-
- .setAdditionalProperties(properties)
- .setGeneratorName("java")
- .setLibrary(JavaClientCodegen.MICROPROFILE)
- .setInputSpec("src/test/resources/bugs/issue_18336.yaml")
- .setOutputDir(output.getAbsolutePath().replace("\\", "/"));
-
- final ClientOptInput clientOptInput = configurator.toClientOptInput();
- DefaultGenerator generator = new DefaultGenerator();
- Map files = generator.opts(clientOptInput).generate().stream()
- .collect(Collectors.toMap(File::getName, Function.identity()));
-
- JavaFileAssert.assertThat(files.get("Pet.java"))
- .assertConstructor("String")
- .assertConstructorAnnotations()
- .containsWithName("JsonCreator")
- .toConstructor()
- .hasParameter("name")
- .assertParameterAnnotations()
- .containsWithNameAndAttributes("JsonProperty", ImmutableMap.of("value", "JSON_PROPERTY_NAME", "required", "true"));
- }
-
@Test
public void testJavaClientDefaultValues_issueNoNumber() throws Exception {
Map properties = new HashMap<>();
@@ -2159,7 +2126,7 @@ public void testJdkHttpClientWithAndWithoutParentExtension() throws Exception {
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 27);
+ Assertions.assertEquals(files.size(), 27);
validateJavaSourceFiles(files);
TestUtils.assertFileContains(
@@ -2497,12 +2464,12 @@ public void testIsOverriddenProperty() {
CodegenModel cm1 = codegen.fromModel("Cat", test1);
CodegenProperty cp0 = cm1.getAllVars().get(0);
- Assert.assertEquals(cp0.getName(), "petType");
- Assert.assertEquals(cp0.isOverridden, true);
+ Assertions.assertEquals(cp0.getName(), "petType");
+ Assertions.assertEquals(cp0.isOverridden, true);
CodegenProperty cp1 = cm1.getAllVars().get(1);
- Assert.assertEquals(cp1.getName(), "name");
- Assert.assertEquals(cp1.isOverridden, false);
+ Assertions.assertEquals(cp1.getName(), "name");
+ Assertions.assertEquals(cp1.isOverridden, false);
}
@Test
@@ -3030,7 +2997,7 @@ public void testHandleConstantParams() throws IOException {
File apiFile = files.get("HelloExampleApi.java");
- assertNotNull(apiFile);
+ Assertions.assertNotNull(apiFile);
JavaFileAssert.assertThat(apiFile)
.assertMethod("helloCall", "String", "ApiCallback")
.bodyContainsLines(
@@ -3154,12 +3121,12 @@ private void testHandleURIEnum(String library, String[] expectedInnerEnumLines,
// enum
File modelFile = files.get("Metadata.java");
- assertNotNull(modelFile);
+ Assertions.assertNotNull(modelFile);
JavaFileAssert.assertThat(modelFile).fileContains(expectedEnumLines);
// Inner enum
File apiFile = files.get("V1SchemasGetDefaultResponse.java");
- assertNotNull(apiFile);
+ Assertions.assertNotNull(apiFile);
JavaFileAssert.assertThat(apiFile).fileContains(expectedInnerEnumLines);
}
@@ -3456,22 +3423,4 @@ public void testRestClientResponseTypeWithUseAbstractionForFiles_issue16589() th
);
}
- @Test
- void testBuilderJavaClient() throws IOException {
- Map files = generateFromContract("src/test/resources/3_0/java/builder.yaml", JavaClientCodegen.RESTTEMPLATE,
- Map.of(AbstractJavaCodegen.GENERATE_BUILDERS, Boolean.TRUE));
- JavaFileAssert.assertThat(files.get("Pet.java"))
- .fileContains("protected String petReadonlyProperty",
- "toBuilder()",
- "builder()",
- "public static class Builder {");
- JavaFileAssert.assertThat(files.get("Snake.java"))
- .fileContains("toBuilder()",
- "builder()",
- "public static class Builder extends Reptile.Builder {",
- ".petType(getPetType())",
- ".name(getName())",
- "hasLegs(getHasLegs())");
- }
-
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/helidon/JavaHelidonCommonCodegenPackagePrefixTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/helidon/JavaHelidonCommonCodegenPackagePrefixTest.java
index f3cc4a4c4908..5e49907e11a2 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/helidon/JavaHelidonCommonCodegenPackagePrefixTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/helidon/JavaHelidonCommonCodegenPackagePrefixTest.java
@@ -26,7 +26,7 @@
import java.util.List;
import java.util.Map;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.TestUtils;
@@ -76,10 +76,10 @@ public void checkInvalidCombinations(String explicitHelidonVersion,
String explicitPrefix,
String generatorName,
String libraryName) {
- IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class,
+ IllegalArgumentException e = Assertions.assertThrows(IllegalArgumentException.class,
() -> runTest(explicitHelidonVersion, explicitPrefix, generatorName, libraryName));
- Assert.assertTrue("Exception message '" + e.getMessage() + "' contains '" + EXCEPTION_MESSAGE_FRAGMENT + "'",
- e.getMessage().contains(EXCEPTION_MESSAGE_FRAGMENT));
+ Assertions.assertTrue(e.getMessage().contains(EXCEPTION_MESSAGE_FRAGMENT),
+ "Exception message '" + e.getMessage() + "' contains '" + EXCEPTION_MESSAGE_FRAGMENT + "'");
}
@DataProvider(name = "valid")
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/helidon/JavaHelidonCommonCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/helidon/JavaHelidonCommonCodegenTest.java
index c92b404c09d4..cd5fab951c38 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/helidon/JavaHelidonCommonCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/helidon/JavaHelidonCommonCodegenTest.java
@@ -26,7 +26,7 @@
import java.util.Locale;
import java.util.Map;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.TestUtils;
@@ -77,8 +77,8 @@ public void bothEqualsVersionTest() {
@Test
public void bothNotEqualsVersionTest() {
- IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class,() -> runVersionTest("1.0.0", "2.0.0"));
- Assert.assertEquals(
+ IllegalArgumentException e = Assertions.assertThrows(IllegalArgumentException.class,() -> runVersionTest("1.0.0", "2.0.0"));
+ Assertions.assertEquals(
"Both parentVersion and helidonVersion properties were set with different value.",
e.getMessage());
}
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 e7023b7225af..29ac5199d74d 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
@@ -22,7 +22,6 @@
import static org.openapitools.codegen.TestUtils.assertFileContains;
import static org.openapitools.codegen.TestUtils.assertFileNotContains;
import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_CONSTRUCTOR_WITH_ALL_ARGS;
-import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_BUILDERS;
import static org.openapitools.codegen.languages.SpringCodegen.ASYNC;
import static org.openapitools.codegen.languages.SpringCodegen.DELEGATE_PATTERN;
import static org.openapitools.codegen.languages.SpringCodegen.DocumentationProvider;
@@ -4324,7 +4323,7 @@ private void assertOptionalMethod(JavaFileAssert javaFileAssert, Class> type,
}
private void assertOptionalMethod(JavaFileAssert javaFileAssert, String type, String expectedName, String getterReturnType){
- assertWrapperMethod(javaFileAssert, "Optional", "of", type, expectedName, getterReturnType);
+ assertWrapperMethod(javaFileAssert, "Optional", type, expectedName, getterReturnType);
}
private void assertJsonNullableMethod(JavaFileAssert javaFileAssert, Class> type, String expectedName, String getterReturnType){
@@ -4332,14 +4331,14 @@ private void assertJsonNullableMethod(JavaFileAssert javaFileAssert, Class> ty
}
private void assertJsonNullableMethod(JavaFileAssert javaFileAssert, String type, String expectedName, String getterReturnType){
- assertWrapperMethod(javaFileAssert, "JsonNullable", "of", type, expectedName, getterReturnType);
+ assertWrapperMethod(javaFileAssert, "JsonNullable", type, expectedName, getterReturnType);
}
- private void assertWrapperMethod(JavaFileAssert javaFileAssert, String wrapperType, String method, String type, String expectedName, String getterReturnType){
+ private void assertWrapperMethod(JavaFileAssert javaFileAssert, String wrapperType, String type, String expectedName, String getterReturnType){
String methodName = StringUtils.capitalize(expectedName);
javaFileAssert.assertMethod(expectedName)
.hasReturnType("Animal")
- .bodyContainsLines("this."+expectedName+" = "+wrapperType+"." + method + "("+expectedName+");", "return this;")
+ .bodyContainsLines("this."+expectedName+" = "+wrapperType+".of("+expectedName+");", "return this;")
.hasParameter(expectedName)
.withType(type)
.toMethod()
@@ -4703,25 +4702,6 @@ public void testLombokAnnotations() throws IOException {
;
}
- @Test
- void testBuilderJavaSpring() throws IOException {
- Map files = generateFromContract("src/test/resources/3_0/java/builder.yaml", SPRING_BOOT,
- Map.of(GENERATE_BUILDERS, true,
- SpringCodegen.USE_OPTIONAL, false));
-
- JavaFileAssert.assertThat(files.get("Pet.java"))
- .fileContains("toBuilder()",
- "builder()",
- "public static class Builder {");
- JavaFileAssert.assertThat(files.get("Snake.java"))
- .fileContains("toBuilder()",
- "builder()",
- "public static class Builder extends Reptile.Builder {",
- "return builder.copyOf(this);");
- JavaFileAssert.assertThat(files.get("SimpleObject.java"))
- .fileContains("public SimpleObject.Builder additionalProperties(Map additionalProperties) {");
- }
-
@Test
public void optionalListShouldBeEmpty() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/jetbrains/http/client/JetbrainsHttpClientClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/jetbrains/http/client/JetbrainsHttpClientClientCodegenTest.java
index 6362f286dfd0..dd283de1bee3 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/jetbrains/http/client/JetbrainsHttpClientClientCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/jetbrains/http/client/JetbrainsHttpClientClientCodegenTest.java
@@ -1,7 +1,7 @@
package org.openapitools.codegen.jetbrains.http.client;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.openapitools.codegen.*;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.openapitools.codegen.languages.JetbrainsHttpClientClientCodegen;
@@ -403,7 +403,7 @@ public void testBasicGenerationManyAuths() throws IOException {
}
@Test
- @Ignore // For some reason this test fails during Docker image generation. Investigate one day.
+ @Disabled // For some reason this test fails during Docker image generation. Investigate one day.
public void testBasicGenerationMultipleRequests() throws IOException {
// Checking that each request example is present in the output file
File output = Files.createTempDirectory("jetbrainstest_").toFile();
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/n4js/N4jsClientCodegenOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/n4js/N4jsClientCodegenOptionsTest.java
index b2e020541405..386599429831 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/n4js/N4jsClientCodegenOptionsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/n4js/N4jsClientCodegenOptionsTest.java
@@ -1,7 +1,7 @@
package org.openapitools.codegen.n4js;
import static java.lang.Boolean.parseBoolean;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.openapitools.codegen.CodegenConstants.API_NAME_PREFIX;
import static org.openapitools.codegen.CodegenConstants.API_PACKAGE;
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java
index e07f01cc32db..b2f8f1e447b2 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java
@@ -24,6 +24,9 @@
import java.util.Map;
+import static org.openapitools.codegen.languages.TypeScriptFetchClientCodegen.CAMEL_CASE;
+import static org.openapitools.codegen.languages.TypeScriptFetchClientCodegen.PASCAL_CASE;
+
public class TypeScriptFetchClientOptionsProvider implements OptionsProvider {
public static final String SORT_PARAMS_VALUE = "false";
public static final String SORT_MODEL_PROPERTIES_VALUE = "false";
@@ -32,9 +35,9 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider {
public static final String IMPORT_FILE_EXTENSION_VALUE = "";
public static final Boolean NULL_SAFE_ADDITIONAL_PROPS_VALUE = false;
public static final String ENUM_NAME_SUFFIX = "Enum";
- public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
- public static final String PARAM_NAMING_VALUE = "camelCase";
- public static final String ENUM_PROPERTY_NAMING_VALUE = "PascalCase";
+ public static final String MODEL_PROPERTY_NAMING_VALUE = CAMEL_CASE;
+ public static final String PARAM_NAMING_VALUE = CAMEL_CASE;
+ public static final String ENUM_PROPERTY_NAMING_VALUE = PASCAL_CASE;
private static final String NMP_NAME = "npmName";
private static final String NMP_VERSION = "1.0.0";
private static final String NPM_REPOSITORY = "https://registry.npmjs.org";
@@ -44,6 +47,7 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider {
public static final String SAGAS_AND_RECORDS = "false";
public static final String ENUM_UNKNOWN_DEFAULT_CASE_VALUE = "false";
public static final String STRING_ENUMS = "false";
+ public static final String FILE_NAMING_VALUE = PASCAL_CASE;
public static final String ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_VALUE = "false";
@Override
@@ -74,6 +78,7 @@ public Map createOptions() {
.put(TypeScriptFetchClientCodegen.WITHOUT_RUNTIME_CHECKS, WITHOUT_RUNTIME_CHECKS)
.put(TypeScriptFetchClientCodegen.SAGAS_AND_RECORDS, SAGAS_AND_RECORDS)
.put(TypeScriptFetchClientCodegen.IMPORT_FILE_EXTENSION_SWITCH, IMPORT_FILE_EXTENSION_VALUE)
+ .put(TypeScriptFetchClientCodegen.FILE_NAMING, FILE_NAMING_VALUE)
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)
.put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true")
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/postman/PostmanCollectionCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/postman/PostmanCollectionCodegenTest.java
index fedee8c1129c..d6471c387e48 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/postman/PostmanCollectionCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/postman/PostmanCollectionCodegenTest.java
@@ -5,7 +5,6 @@
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.swagger.v3.oas.models.tags.Tag;
-import org.junit.Assert;
import org.openapitools.codegen.*;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.openapitools.codegen.languages.PostmanCollectionCodegen;
@@ -22,8 +21,7 @@
import java.util.LinkedHashMap;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
import static org.openapitools.codegen.TestUtils.*;
public class PostmanCollectionCodegenTest {
@@ -33,11 +31,11 @@ public void testInitialConfigValues() throws Exception {
final PostmanCollectionCodegen postmanCollectionCodegen = new PostmanCollectionCodegen();
postmanCollectionCodegen.processOpts();
- Assert.assertEquals(postmanCollectionCodegen.folderStrategy, "Tags");
- Assert.assertEquals(postmanCollectionCodegen.postmanFile, "postman.json");
+ assertEquals(postmanCollectionCodegen.folderStrategy, "Tags");
+ assertEquals(postmanCollectionCodegen.postmanFile, "postman.json");
- Assert.assertNull(postmanCollectionCodegen.additionalProperties().get("codegenOperationsList"));
- Assert.assertNotNull(postmanCollectionCodegen.additionalProperties().get("codegenOperationsByTag"));
+ assertNull(postmanCollectionCodegen.additionalProperties().get("codegenOperationsList"));
+ assertNotNull(postmanCollectionCodegen.additionalProperties().get("codegenOperationsByTag"));
}
@Test
@@ -47,10 +45,10 @@ public void testConfigWithFolderStrategyTags() throws Exception {
postmanCollectionCodegen.additionalProperties().put(postmanCollectionCodegen.FOLDER_STRATEGY, "Tags");
postmanCollectionCodegen.processOpts();
- Assert.assertEquals(postmanCollectionCodegen.folderStrategy, "Tags");
+ assertEquals(postmanCollectionCodegen.folderStrategy, "Tags");
- Assert.assertNull(postmanCollectionCodegen.additionalProperties().get("codegenOperationsList"));
- Assert.assertNotNull(postmanCollectionCodegen.additionalProperties().get("codegenOperationsByTag"));
+ assertNull(postmanCollectionCodegen.additionalProperties().get("codegenOperationsList"));
+ assertNotNull(postmanCollectionCodegen.additionalProperties().get("codegenOperationsByTag"));
}
@Test
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java
index 63b3d0f6016f..b1ec1b42065f 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java
@@ -17,7 +17,7 @@
package org.openapitools.codegen.python;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.google.common.collect.Sets;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
@@ -31,7 +31,6 @@
import static org.openapitools.codegen.TestUtils.assertFileContains;
import static org.openapitools.codegen.TestUtils.assertFileExists;
import org.openapitools.codegen.TestUtils;
-import org.openapitools.codegen.java.assertions.JavaFileAssert;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.File;
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/IndentedLambdaTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/IndentedLambdaTest.java
index 739d632daac5..334e270e8600 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/IndentedLambdaTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/IndentedLambdaTest.java
@@ -1,6 +1,6 @@
package org.openapitools.codegen.templating.mustache;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Map;
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java
index a8f559512820..32e5e42e3255 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java
@@ -6,8 +6,9 @@
import io.swagger.v3.oas.models.media.MapSchema;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.StringSchema;
+import org.apache.commons.lang3.StringUtils;
+import org.openapitools.codegen.*;
import org.openapitools.codegen.config.CodegenConfigurator;
-import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.DefaultGenerator;
@@ -24,11 +25,11 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import static org.assertj.core.api.Assertions.assertThat;
@Test(groups = {TypeScriptGroups.TYPESCRIPT, TypeScriptGroups.TYPESCRIPT_FETCH})
@@ -221,4 +222,99 @@ public void doesNotContainESMTSConfigFileInCaseOfES5AndNPM() {
assertThat(codegen.supportingFiles()).contains(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
assertThat(codegen.supportingFiles()).doesNotContain(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json"));
}
+
+ @Test(description = "Verify file name formatting from model name in PascalCase")
+ public void testModelFileNameInPascalCase() {
+ final TypeScriptFetchClientCodegen codegen = new TypeScriptFetchClientCodegen();
+ codegen.setFileNaming(TypeScriptFetchClientCodegen.PASCAL_CASE);
+ Assert.assertEquals("FirstSimpleModel", codegen.toModelFilename("FirstSimpleModel"));
+ codegen.setModelNameSuffix("suffix");
+ Assert.assertEquals("FirstSimpleModelSuffix", codegen.toModelFilename("FirstSimpleModel"));
+ codegen.setModelNamePrefix("prefix");
+ Assert.assertEquals("PrefixFirstSimpleModelSuffix", codegen.toModelFilename("FirstSimpleModel"));
+ }
+
+ @Test(description = "Verify file name formatting from model name in camelCase")
+ public void testModelFileNameInCamelCase() {
+ final TypeScriptFetchClientCodegen codegen = new TypeScriptFetchClientCodegen();
+ codegen.setFileNaming(TypeScriptFetchClientCodegen.CAMEL_CASE);
+ Assert.assertEquals("firstSimpleModel", codegen.toModelFilename("FirstSimpleModel"));
+ codegen.setModelNameSuffix("suffix");
+ Assert.assertEquals("firstSimpleModelSuffix", codegen.toModelFilename("FirstSimpleModel"));
+ codegen.setModelNamePrefix("prefix");
+ Assert.assertEquals("prefixFirstSimpleModelSuffix", codegen.toModelFilename("FirstSimpleModel"));
+ }
+
+ @Test(description = "Verify file name formatting from model name in kebab-case")
+ public void testModelFileNameInKebabCase() {
+ final TypeScriptFetchClientCodegen codegen = new TypeScriptFetchClientCodegen();
+ codegen.setFileNaming("kebab-case");
+ Assert.assertEquals("first-simple-model", codegen.toModelFilename("FirstSimpleModel"));
+ codegen.setModelNameSuffix("suffix");
+ Assert.assertEquals("first-simple-model-suffix", codegen.toModelFilename("FirstSimpleModel"));
+ codegen.setModelNamePrefix("prefix");
+ Assert.assertEquals("prefix-first-simple-model-suffix", codegen.toModelFilename("FirstSimpleModel"));
+ }
+
+ @Test(description = "Verify file name formatting from api name in PascalCase, camelCase and kebab-case")
+ public void testApiFileNameInVariousFormat() {
+ final TypeScriptFetchClientCodegen codegen = new TypeScriptFetchClientCodegen();
+ codegen.setFileNaming(TypeScriptFetchClientCodegen.PASCAL_CASE);
+ String prefix = codegen.getApiNamePrefix() != null ? codegen.getApiNamePrefix() : "";
+ String suffix = codegen.getApiNameSuffix() != null ? codegen.getApiNameSuffix() : "";
+ Assert.assertEquals(StringUtils.capitalize(prefix + "FirstSimpleController") + StringUtils.capitalize(suffix),
+ codegen.toApiFilename("FirstSimpleController"));
+ codegen.setFileNaming(TypeScriptFetchClientCodegen.CAMEL_CASE);
+ Assert.assertEquals(StringUtils.uncapitalize(prefix + "FirstSimpleController") + StringUtils.capitalize(suffix),
+ codegen.toApiFilename("FirstSimpleController"));
+ codegen.setFileNaming(TypeScriptFetchClientCodegen.KEBAB_CASE);
+ Assert.assertEquals((prefix.isBlank() ? "" : (StringUtils.lowerCase(suffix) + "-")) + "first-simple-controller" + (suffix.isBlank() ? "" : ("-" + StringUtils.lowerCase(suffix))),
+ codegen.toApiFilename("FirstSimpleController"));
+ }
+
+ @Test(description = "Verify names of files generated in kebab-case and imports")
+ public void testGeneratedFilenamesInKebabCase() throws IOException {
+
+ Map properties = new HashMap<>();
+ properties.put("fileNaming", TypeScriptFetchClientCodegen.KEBAB_CASE);
+
+ File output = generate(properties);
+
+ Path pet = Paths.get(output + "/models/pet.ts");
+ TestUtils.assertFileExists(pet);
+ TestUtils.assertFileContains(pet, "} from './pet-category';");
+ TestUtils.assertFileExists(Paths.get(output + "/models/pet-category.ts"));
+ TestUtils.assertFileExists(Paths.get(output + "/apis/pet-controller-api.ts"));
+ }
+
+ @Test(description = "Verify names of files generated in camelCase and imports")
+ public void testGeneratedFilenamesInCamelCase() throws IOException {
+
+ Map properties = new HashMap<>();
+ properties.put("fileNaming", TypeScriptFetchClientCodegen.CAMEL_CASE);
+
+ File output = generate(properties);
+
+ Path pet = Paths.get(output + "/models/pet.ts");
+ TestUtils.assertFileExists(pet);
+ TestUtils.assertFileContains(pet, "} from './petCategory';");
+ TestUtils.assertFileExists(Paths.get(output + "/models/petCategory.ts"));
+ TestUtils.assertFileExists(Paths.get(output + "/apis/petControllerApi.ts"));
+ }
+
+ private static File generate(Map properties) throws IOException {
+ File output = Files.createTempDirectory("test").toFile();
+ output.deleteOnExit();
+
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName("typescript-fetch")
+ .setInputSpec("src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yaml")
+ .setAdditionalProperties(properties)
+ .setOutputDir(output.getAbsolutePath().replace("\\", "/"));
+
+ Generator generator = new DefaultGenerator();
+ List files = generator.opts(configurator.toClientOptInput()).generate();
+ files.forEach(File::deleteOnExit);
+ return output;
+ }
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java
index afbf555beb34..26c9796291d7 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java
@@ -22,6 +22,7 @@
import org.openapitools.codegen.languages.TypeScriptFetchClientCodegen;
import org.openapitools.codegen.options.TypeScriptFetchClientOptionsProvider;
import org.openapitools.codegen.typescript.TypeScriptGroups;
+import org.testng.Assert;
import org.testng.annotations.Test;
import static org.mockito.Mockito.mock;
@@ -53,5 +54,21 @@ protected void verifyOptions() {
verify(clientCodegen).setSagasAndRecords(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.SAGAS_AND_RECORDS));
verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(TypeScriptFetchClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE));
verify(clientCodegen).setStringEnums(Boolean.parseBoolean(TypeScriptFetchClientOptionsProvider.STRING_ENUMS));
+ verify(clientCodegen).setFileNaming(TypeScriptFetchClientOptionsProvider.FILE_NAMING_VALUE);
}
+
+ @Test(description = "Verify if an exception is thrown when invalid values are used with fileNaming option")
+ public void testFileNamingInvalidValues() {
+ final TypeScriptFetchClientCodegen codegen = new TypeScriptFetchClientCodegen();
+ Assert.assertThrows(IllegalArgumentException.class, () ->
+ codegen.setFileNaming(null)
+ );
+ Assert.assertThrows(IllegalArgumentException.class, () ->
+ codegen.setFileNaming("")
+ );
+ Assert.assertThrows(IllegalArgumentException.class, () ->
+ codegen.setFileNaming("invalid-format")
+ );
+ }
+
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchModelTest.java
index 04c0a9b71beb..0c2ad39f41fa 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchModelTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchModelTest.java
@@ -21,6 +21,7 @@
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.parser.util.SchemaTypeUtil;
+import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.DefaultCodegen;
@@ -35,12 +36,7 @@
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
+import java.util.*;
/*
import static io.swagger.codegen.CodegenConstants.IS_ENUM_EXT_NAME;
@@ -480,4 +476,5 @@ public void testNestedNullableSchemas() {
final Map schemaBefore = openAPI.getComponents().getSchemas();
Assert.assertEquals(schemaBefore.keySet(), Sets.newHashSet("club", "owner"));
}
+
}
diff --git a/modules/openapi-generator/src/test/resources/3_0/go-server/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/go-server/petstore.yaml
index 78a7a1ec6cc5..0e249cae5d9e 100644
--- a/modules/openapi-generator/src/test/resources/3_0/go-server/petstore.yaml
+++ b/modules/openapi-generator/src/test/resources/3_0/go-server/petstore.yaml
@@ -100,6 +100,21 @@ paths:
- "OPTION_1"
- "OPTION_2"
- "OPTION_3"
+ - name: defaultInt
+ in: query
+ schema:
+ default: 1
+ type: integer
+ - name: defaultNum
+ in: query
+ schema:
+ default: 1.5
+ type: number
+ - name: defaultStr
+ in: query
+ schema:
+ default: default
+ type: string
- name: status
in: query
description: Status values that need to be considered for filter
@@ -616,9 +631,9 @@ paths:
required: true
schema:
type: string
- - name: boolean_test
+ - name: remember_me
in: query
- description: The password for login in clear text
+ description: Remember Me
schema:
type: boolean
responses:
@@ -731,9 +746,9 @@ paths:
required: true
schema:
type: string
- - name: boolean_test # to ensure boolean query parameter won't cause compilation errors
+ - name: confirmation # to ensure boolean query parameter won't cause compilation errors
in: query
- description: boolean query parameter
+ description: Confirm the deletion
schema:
type: boolean
responses:
diff --git a/modules/openapi-generator/src/test/resources/3_0/issues-anytype-object-set-petstore-everything.yaml b/modules/openapi-generator/src/test/resources/3_0/issues-anytype-object-set-petstore-everything.yaml
new file mode 100644
index 000000000000..3fa84d89af69
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/issues-anytype-object-set-petstore-everything.yaml
@@ -0,0 +1,815 @@
+openapi: 3.0.0
+servers:
+ - url: 'http://petstore.swagger.io/v2'
+info:
+ description: >-
+ This is a sample server Petstore server. For this sample, you can use the api key
+ `special-key` to test the authorization filters.
+ version: 1.0.0
+ title: OpenAPI Petstore
+ license:
+ name: Apache-2.0
+ url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
+tags:
+ - name: pet
+ description: Everything about your Pets
+ - name: store
+ description: Access to Petstore orders
+ - name: user
+ description: Operations about user
+
+paths:
+ /pet:
+ post:
+ tags:
+ - pet
+ summary: Add a new pet to the store
+ description: ''
+ operationId: addPet
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+
+ put:
+ tags:
+ - pet
+ summary: Update an existing pet
+ description: ''
+ operationId: updatePet
+ externalDocs:
+ url: "http://petstore.swagger.io/v2/doc/updatePet"
+ description: "API documentation for the updatePet operation"
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+
+ /pet/findByStatus:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by status
+ description: Multiple status values can be provided with comma separated strings
+ operationId: findPetsByStatus
+ parameters:
+ - name: status
+ in: query
+ description: Status values that need to be considered for filter
+ required: true
+ style: form
+ explode: false
+ deprecated: true
+ schema:
+ type: array
+ items:
+ type: string
+ enum:
+ - available
+ - pending
+ - sold
+ default: available
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - 'read:pets'
+
+ /pet/findByTags:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by tags
+ description: >-
+ Multiple tags can be provided with comma separated strings. Use tag1,
+ tag2, tag3 for testing.
+ operationId: findPetsByTags
+ parameters:
+ - name: tags
+ in: query
+ description: Tags to filter by
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - 'read:pets'
+ deprecated: true
+
+ '/pet/{petId}':
+ get:
+ tags:
+ - pet
+ summary: Find pet by ID
+ description: Returns a single pet
+ operationId: getPetById
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ security:
+ - api_key: []
+
+ post:
+ tags:
+ - pet
+ summary: Updates a pet in the store with form data
+ description: ''
+ operationId: updatePetWithForm
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet that needs to be updated
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ name:
+ description: Updated name of the pet
+ type: string
+ status:
+ description: Updated status of the pet
+ type: string
+
+ delete:
+ tags:
+ - pet
+ summary: Deletes a pet
+ description: ''
+ operationId: deletePet
+ parameters:
+ - name: api_key
+ in: header
+ required: false
+ schema:
+ type: string
+ - name: petId
+ in: path
+ description: Pet id to delete
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '400':
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+
+ '/pet/{petId}/uploadImage':
+ post:
+ tags:
+ - pet
+ summary: uploads an image
+ description: ''
+ operationId: uploadFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ file:
+ description: file to upload
+ type: string
+ format: binary
+
+ /store/inventory:
+ get:
+ tags:
+ - store
+ summary: Returns pet inventories by status
+ description: Returns a map of status codes to quantities
+ operationId: getInventory
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: integer
+ format: int32
+ security:
+ - api_key: []
+
+ /store/order:
+ post:
+ tags:
+ - store
+ summary: Place an order for a pet
+ description: ''
+ operationId: placeOrder
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid Order
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ description: order placed for purchasing the pet
+ required: true
+
+ '/store/order/{orderId}':
+ get:
+ tags:
+ - store
+ summary: Find purchase order by ID
+ description: >-
+ For valid response try integer IDs with value <= 5 or > 10. Other values
+ will generate exceptions
+ operationId: getOrderById
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of pet that needs to be fetched
+ required: true
+ schema:
+ type: integer
+ format: int64
+ minimum: 1
+ maximum: 5
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+
+ delete:
+ tags:
+ - store
+ summary: Delete purchase order by ID
+ description: >-
+ For valid response try integer IDs with value < 1000. Anything above
+ 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of the order that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+
+ /user:
+ post:
+ tags:
+ - user
+ summary: Create user
+ description: This can only be done by the logged in user.
+ operationId: createUser
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Created user object
+ required: true
+
+ /user/createWithArray:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithArrayInput
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+
+ /user/createWithList:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithListInput
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+
+ /user/login:
+ get:
+ tags:
+ - user
+ summary: Logs user into the system
+ description: ''
+ operationId: loginUser
+ parameters:
+ - name: username
+ in: query
+ description: The user name for login
+ required: true
+ schema:
+ type: string
+ pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
+ - name: password
+ in: query
+ description: The password for login in clear text
+ required: true
+ schema:
+ type: string
+
+ responses:
+ '200':
+ description: successful operation
+ headers:
+ Set-Cookie:
+ description: >-
+ Cookie authentication key for use with the `api_key`
+ apiKey authentication.
+ schema:
+ type: string
+ example: AUTH_KEY=abcde12345; Path=/; HttpOnly
+ X-Rate-Limit:
+ description: calls per hour allowed by the user
+ schema:
+ type: integer
+ format: int32
+ X-Expires-After:
+ description: date in UTC when token expires
+ schema:
+ type: string
+ format: date-time
+ content:
+ application/xml:
+ schema:
+ type: string
+ application/json:
+ schema:
+ type: string
+ '400':
+ description: Invalid username/password supplied
+
+ /user/logout:
+ get:
+ tags:
+ - user
+ summary: Logs out current logged in user session
+ description: ''
+ operationId: logoutUser
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+
+ '/user/{username}':
+ get:
+ tags:
+ - user
+ summary: Get user by user name
+ description: ''
+ operationId: getUserByName
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be fetched. Use user1 for testing.
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+
+ put:
+ tags:
+ - user
+ summary: Updated user
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ parameters:
+ - name: username
+ in: path
+ description: name that need to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid user supplied
+ '404':
+ description: User not found
+ security:
+ - api_key: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Updated user object
+ required: true
+
+ delete:
+ tags:
+ - user
+ summary: Delete user
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ security:
+ - api_key: []
+
+externalDocs:
+ description: Find out more about Swagger
+ url: 'http://swagger.io'
+
+components:
+ requestBodies:
+ UserArray:
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ description: List of user object
+ required: true
+
+ Pet:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: Pet object that needs to be added to the store
+ required: true
+
+ securitySchemes:
+ petstore_auth:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
+ scopes:
+ 'write:pets': modify pets in your account
+ 'read:pets': read your pets
+ api_key:
+ type: apiKey
+ name: api_key
+ in: header
+
+ schemas:
+ Order:
+ title: Pet Order
+ description: An order for a pets from the pet store
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ petId:
+ type: integer
+ format: int64
+ quantity:
+ type: integer
+ format: int32
+ shipDate:
+ type: string
+ format: date-time
+ status:
+ type: string
+ description: Order Status
+ enum:
+ - placed
+ - approved
+ - delivered
+ complete:
+ type: boolean
+ default: false
+ xml:
+ name: Order
+
+ Category:
+ title: Pet category
+ description: A category for a pet
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
+ xml:
+ name: Category
+
+ User:
+ title: a User
+ description: A User who is purchasing from the pet store
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ username:
+ type: string
+ firstName:
+ type: string
+ lastName:
+ type: string
+ email:
+ type: string
+ password:
+ type: string
+ phone:
+ type: string
+ userStatus:
+ type: integer
+ format: int32
+ description: User Status
+ xml:
+ name: User
+
+ Tag:
+ title: Pet Tag
+ description: A tag for a pet
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: Tag
+
+ Pet:
+ title: a Pet
+ description: A pet for sale in the pet store
+ type: object
+
+ required:
+ - name
+ - photoUrls
+
+ properties:
+ id:
+ type: integer
+ format: int64
+
+ category:
+ $ref: '#/components/schemas/Category'
+
+ name:
+ type: string
+ example: doggie
+
+ photoUrls:
+ type: array
+ xml:
+ name: photoUrl
+ wrapped: true
+ items:
+ type: string
+
+ tags:
+ type: array
+ xml:
+ name: tag
+ wrapped: true
+ items:
+ $ref: '#/components/schemas/Tag'
+
+ status:
+ type: string
+ description: pet status in the store
+ deprecated: true
+ enum:
+ - available
+ - pending
+ - sold
+
+ # ---------------------------------------------------------
+ # Properties that dedicate this configuration to this issue
+ # ---------------------------------------------------------
+
+ # https://github.com/OpenAPITools/openapi-generator/issues/2769
+ # object property (leading to Object.h)
+ veterinarianVisit:
+ type: object
+ description: last veterinarian visit advice
+
+ # leading to Anytype.h
+ # https://github.com/OpenAPITools/openapi-generator/issues/10266
+ goodies:
+ type: array
+ items: {}
+ nullable: true
+ description: to help you installing your pet at home
+
+ # Leading to Set.h
+ # https://github.com/OpenAPITools/openapi-generator/issues/14234
+ bestFriends:
+ description: Pet best friends!
+ type: object
+
+ required:
+ - bestFriends
+
+ properties:
+ bestFriends:
+ type: array
+ uniqueItems: true
+
+ items:
+ type: string
+
+ xml:
+ name: Pet
+
+ ApiResponse:
+ title: An uploaded response
+ description: Describes the result of uploading an image resource
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ type:
+ type: string
+ message:
+ type: string
diff --git a/modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml
new file mode 100644
index 000000000000..28b35f470715
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml
@@ -0,0 +1,2063 @@
+openapi: 3.0.0
+info:
+ description: >-
+ This spec is mainly for testing Petstore server and contains fake endpoints,
+ models. Please do not use this for any other purpose. Special characters: "
+ \
+ version: 1.0.0
+ title: OpenAPI Petstore
+ license:
+ name: Apache-2.0
+ url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
+tags:
+ - name: pet
+ description: Everything about your Pets
+ - name: store
+ description: Access to Petstore orders
+ - name: user
+ description: Operations about user
+paths:
+ /foo:
+ get:
+ responses:
+ default:
+ description: response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ string:
+ $ref: '#/components/schemas/Foo'
+ /pet:
+ servers:
+ - url: 'http://petstore.swagger.io/v2'
+ - url: 'http://path-server-test.petstore.local/v2'
+ - url: 'http://{server}.swagger.io:{port}/v2'
+ description: test server with variables
+ variables:
+ server:
+ description: target server
+ enum:
+ - 'petstore'
+ - 'qa-petstore'
+ - 'dev-petstore'
+ default: 'petstore'
+ port:
+ enum:
+ - 80
+ - 8080
+ default: 80
+ post:
+ tags:
+ - pet
+ summary: Add a new pet to the store
+ description: ''
+ operationId: addPet
+ responses:
+ '200':
+ description: Successful operation
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ put:
+ tags:
+ - pet
+ summary: Update an existing pet
+ description: ''
+ operationId: updatePet
+ x-webclient-blocking: true
+ responses:
+ '200':
+ description: Successful operation
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ /pet/findByStatus:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by status
+ description: Multiple status values can be provided with comma separated strings
+ operationId: findPetsByStatus
+ x-webclient-blocking: true
+ parameters:
+ - name: status
+ in: query
+ description: Status values that need to be considered for filter
+ required: true
+ style: form
+ explode: false
+ deprecated: true
+ schema:
+ type: array
+ items:
+ type: string
+ enum:
+ - available
+ - pending
+ - sold
+ default: available
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ /pet/findByTags:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by tags
+ description: >-
+ Multiple tags can be provided with comma separated strings. Use tag1,
+ tag2, tag3 for testing.
+ operationId: findPetsByTags
+ x-webclient-blocking: true
+ parameters:
+ - name: tags
+ in: query
+ description: Tags to filter by
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ uniqueItems: true
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ uniqueItems: true
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ uniqueItems: true
+ '400':
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ deprecated: true
+ '/pet/{petId}':
+ get:
+ tags:
+ - pet
+ summary: Find pet by ID
+ description: Returns a single pet
+ operationId: getPetById
+ x-webclient-blocking: true
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ security:
+ - api_key: []
+ post:
+ tags:
+ - pet
+ summary: Updates a pet in the store with form data
+ description: ''
+ operationId: updatePetWithForm
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet that needs to be updated
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: Successful operation
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ name:
+ description: Updated name of the pet
+ type: string
+ status:
+ description: Updated status of the pet
+ type: string
+ delete:
+ tags:
+ - pet
+ summary: Deletes a pet
+ description: ''
+ operationId: deletePet
+ parameters:
+ - name: api_key
+ in: header
+ required: false
+ schema:
+ type: string
+ - name: petId
+ in: path
+ description: Pet id to delete
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: Successful operation
+ '400':
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ '/pet/{petId}/uploadImage':
+ post:
+ tags:
+ - pet
+ summary: uploads an image
+ description: ''
+ operationId: uploadFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ file:
+ description: file to upload
+ type: string
+ format: binary
+ /store/inventory:
+ get:
+ tags:
+ - store
+ summary: Returns pet inventories by status
+ description: Returns a map of status codes to quantities
+ operationId: getInventory
+ x-webclient-blocking: false
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: integer
+ format: int32
+ security:
+ - api_key: []
+ /store/order:
+ post:
+ tags:
+ - store
+ summary: Place an order for a pet
+ description: ''
+ operationId: placeOrder
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid Order
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ description: order placed for purchasing the pet
+ required: true
+ '/store/order/{order_id}':
+ get:
+ tags:
+ - store
+ summary: Find purchase order by ID
+ description: >-
+ For valid response try integer IDs with value <= 5 or > 10. Other values
+ will generate exceptions
+ operationId: getOrderById
+ parameters:
+ - name: order_id
+ in: path
+ description: ID of pet that needs to be fetched
+ required: true
+ schema:
+ type: integer
+ format: int64
+ minimum: 1
+ maximum: 5
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ delete:
+ tags:
+ - store
+ summary: Delete purchase order by ID
+ description: >-
+ For valid response try integer IDs with value < 1000. Anything above
+ 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ parameters:
+ - name: order_id
+ in: path
+ description: ID of the order that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ /user:
+ post:
+ tags:
+ - user
+ summary: Create user
+ description: This can only be done by the logged in user.
+ operationId: createUser
+ responses:
+ default:
+ description: successful operation
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Created user object
+ required: true
+ /user/createWithArray:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithArrayInput
+ responses:
+ default:
+ description: successful operation
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+ /user/createWithList:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithListInput
+ responses:
+ default:
+ description: successful operation
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+ /user/login:
+ get:
+ tags:
+ - user
+ summary: Logs user into the system
+ description: ''
+ operationId: loginUser
+ parameters:
+ - name: username
+ in: query
+ description: The user name for login
+ required: true
+ schema:
+ type: string
+ - name: password
+ in: query
+ description: The password for login in clear text
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ headers:
+ X-Rate-Limit:
+ description: calls per hour allowed by the user
+ schema:
+ type: integer
+ format: int32
+ X-Expires-After:
+ description: date in UTC when token expires
+ schema:
+ type: string
+ format: date-time
+ content:
+ application/xml:
+ schema:
+ type: string
+ application/json:
+ schema:
+ type: string
+ '400':
+ description: Invalid username/password supplied
+ /user/logout:
+ get:
+ tags:
+ - user
+ summary: Logs out current logged in user session
+ description: ''
+ operationId: logoutUser
+ responses:
+ default:
+ description: successful operation
+ '/user/{username}':
+ get:
+ tags:
+ - user
+ summary: Get user by user name
+ description: ''
+ operationId: getUserByName
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be fetched. Use user1 for testing.
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ put:
+ tags:
+ - user
+ summary: Updated user
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ parameters:
+ - name: username
+ in: path
+ description: name that need to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid user supplied
+ '404':
+ description: User not found
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Updated user object
+ required: true
+ delete:
+ tags:
+ - user
+ summary: Delete user
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ /fake_classname_test:
+ patch:
+ tags:
+ - 'fake_classname_tags 123#$%^'
+ summary: To test class name in snake case
+ description: To test class name in snake case
+ operationId: testClassname
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ security:
+ - api_key_query: []
+ requestBody:
+ $ref: '#/components/requestBodies/Client'
+ /fake:
+ patch:
+ tags:
+ - fake
+ summary: To test "client" model
+ description: To test "client" model
+ operationId: testClientModel
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ requestBody:
+ $ref: '#/components/requestBodies/Client'
+ get:
+ tags:
+ - fake
+ summary: To test enum parameters
+ description: To test enum parameters
+ operationId: testEnumParameters
+ parameters:
+ - name: enum_header_string_array
+ in: header
+ description: Header parameter enum test (string array)
+ schema:
+ type: array
+ items:
+ type: string
+ default: $
+ enum:
+ - '>'
+ - $
+ - name: enum_header_string
+ in: header
+ description: Header parameter enum test (string)
+ schema:
+ type: string
+ enum:
+ - _abc
+ - '-efg'
+ - (xyz)
+ default: '-efg'
+ - name: enum_query_string_array
+ in: query
+ description: Query parameter enum test (string array)
+ schema:
+ type: array
+ items:
+ type: string
+ default: $
+ enum:
+ - '>'
+ - $
+ - name: enum_query_string
+ in: query
+ description: Query parameter enum test (string)
+ schema:
+ type: string
+ enum:
+ - _abc
+ - '-efg'
+ - (xyz)
+ default: '-efg'
+ - name: enum_query_integer
+ in: query
+ description: Query parameter enum test (double)
+ schema:
+ type: integer
+ format: int32
+ enum:
+ - 1
+ - -2
+ - name: enum_query_double
+ in: query
+ description: Query parameter enum test (double)
+ schema:
+ type: number
+ format: double
+ enum:
+ - 1.1
+ - -1.2
+ - name: enum_query_model_array
+ in: query
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/EnumClass'
+ responses:
+ '400':
+ description: Invalid request
+ '404':
+ description: Not found
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ enum_form_string_array:
+ description: Form parameter enum test (string array)
+ type: array
+ items:
+ type: string
+ default: $
+ enum:
+ - '>'
+ - $
+ enum_form_string:
+ description: Form parameter enum test (string)
+ type: string
+ enum:
+ - _abc
+ - '-efg'
+ - (xyz)
+ default: '-efg'
+ post:
+ tags:
+ - fake
+ summary: |
+ Fake endpoint for testing various parameters
+ 假端點
+ 偽のエンドポイント
+ 가짜 엔드 포인트
+ description: |
+ Fake endpoint for testing various parameters
+ 假端點
+ 偽のエンドポイント
+ 가짜 엔드 포인트
+ operationId: testEndpointParameters
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ security:
+ - http_basic_test: []
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ integer:
+ description: None
+ type: integer
+ minimum: 10
+ maximum: 100
+ int32:
+ description: None
+ type: integer
+ format: int32
+ minimum: 20
+ maximum: 200
+ int64:
+ description: None
+ type: integer
+ format: int64
+ number:
+ description: None
+ type: number
+ minimum: 32.1
+ maximum: 543.2
+ float:
+ description: None
+ type: number
+ format: float
+ maximum: 987.6
+ double:
+ description: None
+ type: number
+ format: double
+ minimum: 67.8
+ maximum: 123.4
+ string:
+ description: None
+ type: string
+ pattern: '/[a-z]/i'
+ pattern_without_delimiter:
+ description: None
+ type: string
+ pattern: '^[A-Z].*'
+ byte:
+ description: None
+ type: string
+ format: byte
+ binary:
+ description: None
+ type: string
+ format: binary
+ date:
+ description: None
+ type: string
+ format: date
+ dateTime:
+ description: None
+ type: string
+ format: date-time
+ password:
+ description: None
+ type: string
+ format: password
+ minLength: 10
+ maxLength: 64
+ callback:
+ description: None
+ type: string
+ required:
+ - number
+ - double
+ - pattern_without_delimiter
+ - byte
+ delete:
+ tags:
+ - fake
+ security:
+ - bearer_test: []
+ summary: Fake endpoint to test group parameters (optional)
+ description: Fake endpoint to test group parameters (optional)
+ operationId: testGroupParameters
+ x-group-parameters: true
+ parameters:
+ - name: required_string_group
+ in: query
+ description: Required String in group parameters
+ required: true
+ schema:
+ type: integer
+ - name: required_boolean_group
+ in: header
+ description: Required Boolean in group parameters
+ required: true
+ schema:
+ type: boolean
+ - name: required_int64_group
+ in: query
+ description: Required Integer in group parameters
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: string_group
+ in: query
+ description: String in group parameters
+ schema:
+ type: integer
+ - name: boolean_group
+ in: header
+ description: Boolean in group parameters
+ schema:
+ type: boolean
+ - name: int64_group
+ in: query
+ description: Integer in group parameters
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '400':
+ description: Something wrong
+ /fake/outer/number:
+ post:
+ tags:
+ - fake
+ description: Test serialization of outer number types
+ operationId: fakeOuterNumberSerialize
+ responses:
+ '200':
+ description: Output number
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterNumber'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterNumber'
+ description: Input number as post body
+ /fake/property/enum-int:
+ post:
+ tags:
+ - fake
+ description: Test serialization of enum (int) properties with examples
+ operationId: fakePropertyEnumIntegerSerialize
+ responses:
+ '200':
+ description: Output enum (int)
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterObjectWithEnumProperty'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterObjectWithEnumProperty'
+ description: Input enum (int) as post body
+ /fake/outer/string:
+ post:
+ tags:
+ - fake
+ description: Test serialization of outer string types
+ operationId: fakeOuterStringSerialize
+ responses:
+ '200':
+ description: Output string
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterString'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterString'
+ description: Input string as post body
+ /fake/outer/boolean:
+ post:
+ tags:
+ - fake
+ description: Test serialization of outer boolean types
+ operationId: fakeOuterBooleanSerialize
+ responses:
+ '200':
+ description: Output boolean
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterBoolean'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterBoolean'
+ description: Input boolean as post body
+ /fake/outer/composite:
+ post:
+ tags:
+ - fake
+ description: Test serialization of object with outer number type
+ operationId: fakeOuterCompositeSerialize
+ responses:
+ '200':
+ description: Output composite
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterComposite'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterComposite'
+ description: Input composite as post body
+ /fake/BigDecimalMap:
+ get:
+ tags:
+ - fake
+ description: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys
+ operationId: fakeBigDecimalMap
+ responses:
+ '200':
+ description: successful operation
+ content:
+ '*/*':
+ schema:
+ type: object
+ properties:
+ someId:
+ type: number
+ someMap:
+ type: object
+ additionalProperties:
+ type: number
+ /fake/jsonFormData:
+ get:
+ tags:
+ - fake
+ summary: test json serialization of form data
+ description: ''
+ operationId: testJsonFormData
+ responses:
+ '200':
+ description: successful operation
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ param:
+ description: field1
+ type: string
+ param2:
+ description: field2
+ type: string
+ required:
+ - param
+ - param2
+ /fake/additionalProperties-reference:
+ post:
+ tags:
+ - fake
+ summary: test referenced additionalProperties
+ description: ''
+ operationId: testAdditionalPropertiesReference
+ responses:
+ '200':
+ description: successful operation
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/FreeFormObject'
+ description: request body
+ required: true
+ /fake/stringMap-reference:
+ post:
+ tags:
+ - fake
+ summary: test referenced string map
+ description: ''
+ operationId: testStringMapReference
+ responses:
+ '200':
+ description: successful operation
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MapOfString'
+ description: request body
+ required: true
+ /fake/inline-additionalProperties:
+ post:
+ tags:
+ - fake
+ summary: test inline additionalProperties
+ description: ''
+ operationId: testInlineAdditionalProperties
+ responses:
+ '200':
+ description: successful operation
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: string
+ description: request body
+ required: true
+ /fake/inline-freeform-additionalProperties:
+ post:
+ tags:
+ - fake
+ summary: test inline free-form additionalProperties
+ description: ''
+ operationId: testInlineFreeformAdditionalProperties
+ responses:
+ '200':
+ description: successful operation
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ someProperty:
+ type: string
+ additionalProperties: true
+ description: request body
+ required: true
+ /fake/nullable:
+ post:
+ tags:
+ - fake
+ summary: test nullable parent property
+ description: ""
+ operationId: testNullable
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ChildWithNullable'
+ description: request body
+ required: true
+ responses:
+ "200":
+ description: successful operation
+ /fake/body-with-query-params:
+ put:
+ tags:
+ - fake
+ operationId: testBodyWithQueryParams
+ parameters:
+ - name: query
+ in: query
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Success
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ required: true
+ /another-fake/dummy:
+ patch:
+ tags:
+ - $another-fake?
+ summary: To test special tags
+ description: To test special tags and operation ID starting with number
+ operationId: '123_test_@#$%_special_tags'
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ requestBody:
+ $ref: '#/components/requestBodies/Client'
+ /fake/body-with-file-schema:
+ put:
+ tags:
+ - fake
+ description: >-
+ For this test, the body for this request must reference a schema named
+ `File`.
+ operationId: testBodyWithFileSchema
+ responses:
+ '200':
+ description: Success
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/FileSchemaTestClass'
+ required: true
+ /fake/body-with-binary:
+ put:
+ tags:
+ - fake
+ description: >-
+ For this test, the body has to be a binary file.
+ operationId: testBodyWithBinary
+ responses:
+ '200':
+ description: Success
+ requestBody:
+ content:
+ image/png:
+ schema:
+ type: string
+ nullable: true
+ format: binary
+ description: image to upload
+ required: true
+ /fake/test-query-parameters:
+ put:
+ tags:
+ - fake
+ description: To test the collection format in query parameters
+ operationId: testQueryParameterCollectionFormat
+ parameters:
+ - name: pipe
+ in: query
+ required: true
+ style: pipeDelimited
+ schema:
+ type: array
+ items:
+ type: string
+ - name: ioutil
+ in: query
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ - name: http
+ in: query
+ required: true
+ style: spaceDelimited
+ schema:
+ type: array
+ items:
+ type: string
+ - name: url
+ in: query
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ - name: context
+ in: query
+ required: true
+ explode: true
+ schema:
+ type: array
+ items:
+ type: string
+ - name: language
+ in: query
+ required: false
+ schema:
+ type: object
+ additionalProperties:
+ type: string
+ format: string
+ - name: allowEmpty
+ in: query
+ required: true
+ allowEmptyValue: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ '/fake/{petId}/uploadImageWithRequiredFile':
+ post:
+ tags:
+ - pet
+ summary: uploads an image (required)
+ description: ''
+ operationId: uploadFileWithRequiredFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ requiredFile:
+ description: file to upload
+ type: string
+ format: binary
+ required:
+ - requiredFile
+ /fake/health:
+ get:
+ tags:
+ - fake
+ summary: Health check endpoint
+ responses:
+ 200:
+ description: The instance started successfully
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HealthCheckResult'
+ /fake/http-signature-test:
+ get:
+ tags:
+ - fake
+ summary: test http signature authentication
+ operationId: fake-http-signature-test
+ parameters:
+ - name: query_1
+ in: query
+ description: query parameter
+ required: optional
+ schema:
+ type: string
+ - name: header_1
+ in: header
+ description: header parameter
+ required: optional
+ schema:
+ type: string
+ security:
+ - http_signature_test: []
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ responses:
+ 200:
+ description: The instance started successfully
+servers:
+ - url: 'http://{server}.swagger.io:{port}/v2'
+ description: petstore server
+ variables:
+ server:
+ enum:
+ - 'petstore'
+ - 'qa-petstore'
+ - 'dev-petstore'
+ default: 'petstore'
+ port:
+ enum:
+ - 80
+ - 8080
+ default: 80
+ - url: https://localhost:8080/{version}
+ description: The local server
+ variables:
+ version:
+ enum:
+ - 'v1'
+ - 'v2'
+ default: 'v2'
+ - url: https://127.0.0.1/no_varaible
+ description: The local server without variables
+components:
+ requestBodies:
+ UserArray:
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ description: List of user object
+ required: true
+ Client:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ description: client model
+ required: true
+ Pet:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: Pet object that needs to be added to the store
+ required: true
+ securitySchemes:
+ petstore_auth:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
+ scopes:
+ 'write:pets': modify pets in your account
+ 'read:pets': read your pets
+ api_key:
+ type: apiKey
+ name: api_key
+ in: header
+ api_key_query:
+ type: apiKey
+ name: api_key_query
+ in: query
+ http_basic_test:
+ type: http
+ scheme: basic
+ bearer_test:
+ type: http
+ scheme: bearer
+ bearerFormat: JWT
+ http_signature_test:
+ type: http
+ scheme: signature
+ schemas:
+ Foo:
+ type: object
+ properties:
+ bar:
+ $ref: '#/components/schemas/Bar'
+ Bar:
+ type: string
+ default: bar
+ Order:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ petId:
+ type: integer
+ format: int64
+ quantity:
+ type: integer
+ format: int32
+ shipDate:
+ type: string
+ format: date-time
+ status:
+ type: string
+ description: Order Status
+ enum:
+ - placed
+ - approved
+ - delivered
+ complete:
+ type: boolean
+ default: false
+ xml:
+ name: Order
+ Category:
+ type: object
+ required:
+ - name
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ default: default-name
+ xml:
+ name: Category
+ User:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ x-is-unique: true
+ username:
+ type: string
+ firstName:
+ type: string
+ lastName:
+ type: string
+ email:
+ type: string
+ password:
+ type: string
+ phone:
+ type: string
+ userStatus:
+ type: integer
+ format: int32
+ description: User Status
+ xml:
+ name: User
+ Tag:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: Tag
+ Pet:
+ type: object
+ required:
+ - name
+ - photoUrls
+ properties:
+ id:
+ type: integer
+ format: int64
+ x-is-unique: true
+ category:
+ $ref: '#/components/schemas/Category'
+ name:
+ type: string
+ example: doggie
+ photoUrls:
+ type: array
+ xml:
+ name: photoUrl
+ wrapped: true
+ items:
+ type: string
+ uniqueItems: true
+ tags:
+ type: array
+ xml:
+ name: tag
+ wrapped: true
+ items:
+ $ref: '#/components/schemas/Tag'
+ status:
+ type: string
+ description: pet status in the store
+ enum:
+ - available
+ - pending
+ - sold
+ xml:
+ name: Pet
+ ApiResponse:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ type:
+ type: string
+ message:
+ type: string
+ Return:
+ description: Model for testing reserved words
+ properties:
+ return:
+ type: integer
+ format: int32
+ xml:
+ name: Return
+ Name:
+ description: Model for testing model name same as property name
+ required:
+ - name
+ properties:
+ name:
+ type: integer
+ format: int32
+ snake_case:
+ readOnly: true
+ type: integer
+ format: int32
+ property:
+ type: string
+ 123Number:
+ type: integer
+ readOnly: true
+ xml:
+ name: Name
+ 200_response:
+ description: Model for testing model name starting with number
+ properties:
+ name:
+ type: integer
+ format: int32
+ class:
+ type: string
+ xml:
+ name: Name
+ ClassModel:
+ description: Model for testing model with "_class" property
+ properties:
+ _class:
+ type: string
+ Dog:
+ allOf:
+ - $ref: '#/components/schemas/Animal'
+ - type: object
+ properties:
+ breed:
+ type: string
+ Cat:
+ allOf:
+ - $ref: '#/components/schemas/Animal'
+ - type: object
+ properties:
+ declawed:
+ type: boolean
+ Animal:
+ type: object
+ discriminator:
+ propertyName: className
+ mapping:
+ DOG: '#/components/schemas/Dog'
+ CAT: '#/components/schemas/Cat'
+ required:
+ - className
+ properties:
+ className:
+ type: string
+ color:
+ type: string
+ default: red
+ AnimalFarm:
+ type: array
+ items:
+ $ref: '#/components/schemas/Animal'
+ format_test:
+ type: object
+ required:
+ - number
+ - byte
+ - date
+ - password
+ properties:
+ integer:
+ type: integer
+ maximum: 100
+ minimum: 10
+ int32:
+ type: integer
+ format: int32
+ maximum: 200
+ minimum: 20
+ int64:
+ type: integer
+ format: int64
+ number:
+ maximum: 543.2
+ minimum: 32.1
+ type: number
+ float:
+ type: number
+ format: float
+ maximum: 987.6
+ minimum: 54.3
+ double:
+ type: number
+ format: double
+ maximum: 123.4
+ minimum: 67.8
+ decimal:
+ type: string
+ format: number
+ string:
+ type: string
+ pattern: '/[a-z]/i'
+ byte:
+ type: string
+ format: byte
+ binary:
+ type: string
+ format: binary
+ date:
+ type: string
+ format: date
+ dateTime:
+ type: string
+ format: date-time
+ uuid:
+ type: string
+ format: uuid
+ example: 72f98069-206d-4f12-9f12-3d1e525a8e84
+ password:
+ type: string
+ format: password
+ maxLength: 64
+ minLength: 10
+ pattern_with_digits:
+ description: A string that is a 10 digit number. Can have leading zeros.
+ type: string
+ pattern: '^\d{10}$'
+ pattern_with_digits_and_delimiter:
+ description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
+ type: string
+ pattern: '/^image_\d{1,3}$/i'
+ EnumClass:
+ type: string
+ default: '-efg'
+ enum:
+ - _abc
+ - '-efg'
+ - (xyz)
+ Enum_Test:
+ type: object
+ required:
+ - enum_string_required
+ properties:
+ enum_string:
+ type: string
+ enum:
+ - UPPER
+ - lower
+ - ''
+ enum_string_required:
+ type: string
+ enum:
+ - UPPER
+ - lower
+ - ''
+ enum_integer:
+ type: integer
+ format: int32
+ enum:
+ - 1
+ - -1
+ enum_number:
+ type: number
+ format: double
+ enum:
+ - 1.1
+ - -1.2
+ outerEnum:
+ $ref: '#/components/schemas/OuterEnum'
+ outerEnumInteger:
+ $ref: '#/components/schemas/OuterEnumInteger'
+ outerEnumDefaultValue:
+ $ref: '#/components/schemas/OuterEnumDefaultValue'
+ outerEnumIntegerDefaultValue:
+ $ref: '#/components/schemas/OuterEnumIntegerDefaultValue'
+ AdditionalPropertiesClass:
+ type: object
+ properties:
+ map_property:
+ type: object
+ additionalProperties:
+ type: string
+ map_of_map_property:
+ type: object
+ additionalProperties:
+ type: object
+ additionalProperties:
+ type: string
+ MixedPropertiesAndAdditionalPropertiesClass:
+ type: object
+ properties:
+ uuid:
+ type: string
+ format: uuid
+ dateTime:
+ type: string
+ format: date-time
+ map:
+ type: object
+ additionalProperties:
+ $ref: '#/components/schemas/Animal'
+ List:
+ type: object
+ properties:
+ 123-list:
+ type: string
+ Client:
+ type: object
+ properties:
+ client:
+ type: string
+ ReadOnlyFirst:
+ type: object
+ properties:
+ bar:
+ type: string
+ readOnly: true
+ baz:
+ type: string
+ hasOnlyReadOnly:
+ type: object
+ properties:
+ bar:
+ type: string
+ readOnly: true
+ foo:
+ type: string
+ readOnly: true
+ Capitalization:
+ type: object
+ properties:
+ smallCamel:
+ type: string
+ CapitalCamel:
+ type: string
+ small_Snake:
+ type: string
+ Capital_Snake:
+ type: string
+ SCA_ETH_Flow_Points:
+ type: string
+ ATT_NAME:
+ description: |
+ Name of the pet
+ type: string
+ MapTest:
+ type: object
+ properties:
+ map_map_of_string:
+ type: object
+ additionalProperties:
+ type: object
+ additionalProperties:
+ type: string
+ map_of_enum_string:
+ type: object
+ additionalProperties:
+ type: string
+ enum:
+ - UPPER
+ - lower
+ direct_map:
+ type: object
+ additionalProperties:
+ type: boolean
+ indirect_map:
+ $ref: '#/components/schemas/StringBooleanMap'
+ ArrayTest:
+ type: object
+ properties:
+ array_of_string:
+ type: array
+ items:
+ type: string
+ minItems: 0
+ maxItems: 3
+ array_array_of_integer:
+ type: array
+ items:
+ type: array
+ items:
+ type: integer
+ format: int64
+ array_array_of_model:
+ type: array
+ items:
+ type: array
+ items:
+ $ref: '#/components/schemas/ReadOnlyFirst'
+ NumberOnly:
+ type: object
+ properties:
+ JustNumber:
+ type: number
+ ArrayOfNumberOnly:
+ type: object
+ properties:
+ ArrayNumber:
+ type: array
+ items:
+ type: number
+ ArrayOfArrayOfNumberOnly:
+ type: object
+ properties:
+ ArrayArrayNumber:
+ type: array
+ items:
+ type: array
+ items:
+ type: number
+ EnumArrays:
+ type: object
+ properties:
+ just_symbol:
+ type: string
+ enum:
+ - '>='
+ - $
+ array_enum:
+ type: array
+ items:
+ type: string
+ enum:
+ - fish
+ - crab
+ FreeFormObject:
+ type: object
+ description: A schema consisting only of additional properties
+ additionalProperties: true
+ MapOfString:
+ type: object
+ description: A schema consisting only of additional properties of type string
+ additionalProperties:
+ type: string
+ OuterEnum:
+ nullable: true
+ type: string
+ enum:
+ - placed
+ - approved
+ - delivered
+ OuterEnumInteger:
+ type: integer
+ enum:
+ - 0
+ - 1
+ - 2
+ example: 2
+ OuterEnumDefaultValue:
+ type: string
+ enum:
+ - placed
+ - approved
+ - delivered
+ default: placed
+ OuterEnumIntegerDefaultValue:
+ type: integer
+ enum:
+ - 0
+ - 1
+ - 2
+ default: 0
+ OuterComposite:
+ type: object
+ properties:
+ my_number:
+ $ref: '#/components/schemas/OuterNumber'
+ my_string:
+ $ref: '#/components/schemas/OuterString'
+ my_boolean:
+ $ref: '#/components/schemas/OuterBoolean'
+ OuterNumber:
+ type: number
+ OuterString:
+ type: string
+ OuterBoolean:
+ type: boolean
+ x-codegen-body-parameter-name: boolean_post_body
+ ParentWithNullable:
+ type: object
+ discriminator:
+ propertyName: type
+ properties:
+ type:
+ type: string
+ enum:
+ - ChildWithNullable
+ nullableProperty:
+ type: string
+ nullable: true
+ ChildWithNullable:
+ allOf:
+ - $ref: '#/components/schemas/ParentWithNullable'
+ - type: object
+ properties:
+ otherProperty:
+ type: string
+ StringBooleanMap:
+ additionalProperties:
+ type: boolean
+ FileSchemaTestClass:
+ type: object
+ properties:
+ file:
+ $ref: '#/components/schemas/File'
+ files:
+ type: array
+ items:
+ $ref: '#/components/schemas/File'
+ File:
+ type: object
+ description: Must be named `File` for test.
+ properties:
+ sourceURI:
+ description: Test capitalization
+ type: string
+ _special_model.name_:
+ properties:
+ '$special[property.name]':
+ type: integer
+ format: int64
+ xml:
+ name: '$special[model.name]'
+ HealthCheckResult:
+ type: object
+ properties:
+ NullableMessage:
+ nullable: true
+ type: string
+ description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
+ NullableClass:
+ type: object
+ properties:
+ integer_prop:
+ type: integer
+ nullable: true
+ number_prop:
+ type: number
+ nullable: true
+ boolean_prop:
+ type: boolean
+ nullable: true
+ string_prop:
+ type: string
+ nullable: true
+ date_prop:
+ type: string
+ format: date
+ nullable: true
+ datetime_prop:
+ type: string
+ format: date-time
+ nullable: true
+ array_nullable_prop:
+ type: array
+ nullable: true
+ items:
+ type: object
+ array_and_items_nullable_prop:
+ type: array
+ nullable: true
+ items:
+ type: object
+ nullable: true
+ array_items_nullable:
+ type: array
+ items:
+ type: object
+ nullable: true
+ object_nullable_prop:
+ type: object
+ nullable: true
+ additionalProperties:
+ type: object
+ object_and_items_nullable_prop:
+ type: object
+ nullable: true
+ additionalProperties:
+ type: object
+ nullable: true
+ object_items_nullable:
+ type: object
+ additionalProperties:
+ type: object
+ nullable: true
+ additionalProperties:
+ type: object
+ nullable: true
+ OuterObjectWithEnumProperty:
+ type: object
+ example:
+ value: 2
+ required:
+ - value
+ properties:
+ value:
+ $ref: '#/components/schemas/OuterEnumInteger'
+ DeprecatedObject:
+ type: object
+ deprecated: true
+ properties:
+ name:
+ type: string
+ ObjectWithDeprecatedFields:
+ type: object
+ properties:
+ uuid:
+ type: string
+ id:
+ type: number
+ deprecated: true
+ deprecatedRef:
+ $ref: '#/components/schemas/DeprecatedObject'
+ bars:
+ type: array
+ deprecated: true
+ items:
+ $ref: '#/components/schemas/Bar'
+ AllOfWithSingleRef:
+ type: object
+ properties:
+ username:
+ type: string
+ SingleRefType:
+ allOf:
+ - $ref: '#/components/schemas/SingleRefType'
+ SingleRefType:
+ type: string
+ title: SingleRefType
+ enum:
+ - admin
+ - user
diff --git a/modules/openapi-generator/src/test/resources/3_0/nested-schema-refs.yaml b/modules/openapi-generator/src/test/resources/3_0/nested-schema-refs.yaml
new file mode 100644
index 000000000000..8e03562fb83e
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/nested-schema-refs.yaml
@@ -0,0 +1,37 @@
+openapi: 3.0.0
+info:
+ version: 1.0.0
+ title: Test swagger file
+
+paths:
+ /pet:
+ get:
+ tags:
+ - store
+ operationId: getNestedObject
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/outerType'
+components:
+ schemas:
+ outerType:
+ type: object
+ required:
+ - middle
+ properties:
+ middle:
+ $ref: '#/components/schemas/middleType'
+ middleType:
+ type: object
+ required:
+ - inner
+ properties:
+ inner:
+ $ref: '#/components/schemas/innerType'
+ innerType:
+ type: string
+
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-multiple-2xx-responses.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-multiple-2xx-responses.yaml
new file mode 100644
index 000000000000..dbe18bd8b046
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/petstore-multiple-2xx-responses.yaml
@@ -0,0 +1,754 @@
+openapi: 3.0.0
+servers:
+ - url: 'http://petstore.swagger.io/v2'
+info:
+ description: >-
+ This is a sample server Petstore server. For this sample, you can use the api key
+ `special-key` to test the authorization filters.
+ version: 1.0.0
+ title: OpenAPI Petstore
+ license:
+ name: Apache-2.0
+ url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
+tags:
+ - name: pet
+ description: Everything about your Pets
+ - name: store
+ description: Access to Petstore orders
+ - name: user
+ description: Operations about user
+paths:
+ /pet:
+ post:
+ tags:
+ - pet
+ summary: Add a new pet to the store
+ description: ''
+ operationId: addPet
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ put:
+ tags:
+ - pet
+ summary: Update an existing pet
+ description: ''
+ operationId: updatePet
+ externalDocs:
+ url: "http://petstore.swagger.io/v2/doc/updatePet"
+ description: "API documentation for the updatePet operation"
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ /pet/findByStatus:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by status
+ description: Multiple status values can be provided with comma separated strings
+ operationId: findPetsByStatus
+ parameters:
+ - name: status
+ in: query
+ description: Status values that need to be considered for filter
+ required: true
+ style: form
+ explode: false
+ deprecated: true
+ schema:
+ type: array
+ items:
+ type: string
+ enum:
+ - available
+ - pending
+ - sold
+ default: available
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - 'read:pets'
+ /pet/findByTags:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by tags
+ description: >-
+ Multiple tags can be provided with comma separated strings. Use tag1,
+ tag2, tag3 for testing.
+ operationId: findPetsByTags
+ parameters:
+ - name: tags
+ in: query
+ description: Tags to filter by
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '206':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - 'read:pets'
+ deprecated: true
+ '/pet/{petId}':
+ get:
+ tags:
+ - pet
+ summary: Find pet by ID
+ description: Returns a single pet
+ operationId: getPetById
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ security:
+ - api_key: []
+ post:
+ tags:
+ - pet
+ summary: Updates a pet in the store with form data
+ description: ''
+ operationId: updatePetWithForm
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet that needs to be updated
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ name:
+ description: Updated name of the pet
+ type: string
+ status:
+ description: Updated status of the pet
+ type: string
+ delete:
+ tags:
+ - pet
+ summary: Deletes a pet
+ description: ''
+ operationId: deletePet
+ parameters:
+ - name: api_key
+ in: header
+ required: false
+ schema:
+ type: string
+ - name: petId
+ in: path
+ description: Pet id to delete
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '400':
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ '/pet/{petId}/uploadImage':
+ post:
+ tags:
+ - pet
+ summary: uploads an image
+ description: ''
+ operationId: uploadFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ file:
+ description: file to upload
+ type: string
+ format: binary
+ /store/inventory:
+ get:
+ tags:
+ - store
+ summary: Returns pet inventories by status
+ description: Returns a map of status codes to quantities
+ operationId: getInventory
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: integer
+ format: int32
+ security:
+ - api_key: []
+ /store/order:
+ post:
+ tags:
+ - store
+ summary: Place an order for a pet
+ description: ''
+ operationId: placeOrder
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid Order
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ description: order placed for purchasing the pet
+ required: true
+ '/store/order/{orderId}':
+ get:
+ tags:
+ - store
+ summary: Find purchase order by ID
+ description: >-
+ For valid response try integer IDs with value <= 5 or > 10. Other values
+ will generate exceptions
+ operationId: getOrderById
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of pet that needs to be fetched
+ required: true
+ schema:
+ type: integer
+ format: int64
+ minimum: 1
+ maximum: 5
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ delete:
+ tags:
+ - store
+ summary: Delete purchase order by ID
+ description: >-
+ For valid response try integer IDs with value < 1000. Anything above
+ 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of the order that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ /user:
+ post:
+ tags:
+ - user
+ summary: Create user
+ description: This can only be done by the logged in user.
+ operationId: createUser
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Created user object
+ required: true
+ /user/createWithArray:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithArrayInput
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+ /user/createWithList:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithListInput
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+ /user/login:
+ get:
+ tags:
+ - user
+ summary: Logs user into the system
+ description: ''
+ operationId: loginUser
+ parameters:
+ - name: username
+ in: query
+ description: The user name for login
+ required: true
+ schema:
+ type: string
+ pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
+ - name: password
+ in: query
+ description: The password for login in clear text
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ headers:
+ Set-Cookie:
+ description: >-
+ Cookie authentication key for use with the `api_key`
+ apiKey authentication.
+ schema:
+ type: string
+ example: AUTH_KEY=abcde12345; Path=/; HttpOnly
+ X-Rate-Limit:
+ description: calls per hour allowed by the user
+ schema:
+ type: integer
+ format: int32
+ X-Expires-After:
+ description: date in UTC when token expires
+ schema:
+ type: string
+ format: date-time
+ content:
+ application/xml:
+ schema:
+ type: string
+ application/json:
+ schema:
+ type: string
+ '400':
+ description: Invalid username/password supplied
+ /user/logout:
+ get:
+ tags:
+ - user
+ summary: Logs out current logged in user session
+ description: ''
+ operationId: logoutUser
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ '/user/{username}':
+ get:
+ tags:
+ - user
+ summary: Get user by user name
+ description: ''
+ operationId: getUserByName
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be fetched. Use user1 for testing.
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ put:
+ tags:
+ - user
+ summary: Updated user
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ parameters:
+ - name: username
+ in: path
+ description: name that need to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid user supplied
+ '404':
+ description: User not found
+ security:
+ - api_key: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Updated user object
+ required: true
+ delete:
+ tags:
+ - user
+ summary: Delete user
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ security:
+ - api_key: []
+externalDocs:
+ description: Find out more about Swagger
+ url: 'http://swagger.io'
+components:
+ requestBodies:
+ UserArray:
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ description: List of user object
+ required: true
+ Pet:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: Pet object that needs to be added to the store
+ required: true
+ securitySchemes:
+ petstore_auth:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
+ scopes:
+ 'write:pets': modify pets in your account
+ 'read:pets': read your pets
+ api_key:
+ type: apiKey
+ name: api_key
+ in: header
+ schemas:
+ Order:
+ title: Pet Order
+ description: An order for a pets from the pet store
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ petId:
+ type: integer
+ format: int64
+ quantity:
+ type: integer
+ format: int32
+ shipDate:
+ type: string
+ format: date-time
+ status:
+ type: string
+ description: Order Status
+ enum:
+ - placed
+ - approved
+ - delivered
+ complete:
+ type: boolean
+ default: false
+ xml:
+ name: Order
+ Category:
+ title: Pet category
+ description: A category for a pet
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
+ xml:
+ name: Category
+ User:
+ title: a User
+ description: A User who is purchasing from the pet store
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ username:
+ type: string
+ firstName:
+ type: string
+ lastName:
+ type: string
+ email:
+ type: string
+ password:
+ type: string
+ phone:
+ type: string
+ userStatus:
+ type: integer
+ format: int32
+ description: User Status
+ xml:
+ name: User
+ Tag:
+ title: Pet Tag
+ description: A tag for a pet
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: Tag
+ Pet:
+ title: a Pet
+ description: A pet for sale in the pet store
+ type: object
+ required:
+ - name
+ - photoUrls
+ properties:
+ id:
+ type: integer
+ format: int64
+ category:
+ $ref: '#/components/schemas/Category'
+ name:
+ type: string
+ example: doggie
+ photoUrls:
+ type: array
+ xml:
+ name: photoUrl
+ wrapped: true
+ items:
+ type: string
+ tags:
+ type: array
+ xml:
+ name: tag
+ wrapped: true
+ items:
+ $ref: '#/components/schemas/Tag'
+ status:
+ type: string
+ description: pet status in the store
+ deprecated: true
+ enum:
+ - available
+ - pending
+ - sold
+ xml:
+ name: Pet
+ ApiResponse:
+ title: An uploaded response
+ description: Describes the result of uploading an image resource
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ type:
+ type: string
+ message:
+ type: string
diff --git a/modules/openapi-generator/src/test/resources/3_0/rust-axum/rust-axum-header-uuid.yaml b/modules/openapi-generator/src/test/resources/3_0/rust-axum/rust-axum-header-uuid.yaml
new file mode 100644
index 000000000000..e2aee6440aa2
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/rust-axum/rust-axum-header-uuid.yaml
@@ -0,0 +1,32 @@
+# Test deserialization of uuid objects in headers
+openapi: 3.0.0
+info:
+ title: Sample API
+ version: 0.1.9
+paths:
+ /users:
+ post:
+ description: Adds a user to the users database table.
+ parameters:
+ - $ref: "#/components/parameters/UuidHeaderParam"
+ responses:
+ "201": # status code
+ description: Added row to table!
+ content:
+ application/json:
+ schema:
+ type: string
+components:
+ schemas:
+ HeaderUuid:
+ type: string
+ format: uuid
+ example: a9f5a638-728c-479d-af9b-016eb8049ab6
+ parameters:
+ UuidHeaderParam:
+ name: some_uid
+ in: header
+ required: true
+ description: A uuid transmitted in the header.
+ schema:
+ $ref: "#/components/schemas/HeaderUuid"
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/resources/3_0/rust/rust-axum-validation-test.yaml b/modules/openapi-generator/src/test/resources/3_0/rust/rust-axum-validation-test.yaml
new file mode 100644
index 000000000000..d14420556877
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/rust/rust-axum-validation-test.yaml
@@ -0,0 +1,23 @@
+openapi: 3.0.1
+info:
+ title: Test to check that validation logic is not rendered when disabled.
+ version: 0.0.1
+paths:
+ /mail:
+ put:
+ description: Updates the email.
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Email"
+ responses:
+ "204":
+ description: OK.
+components:
+ schemas:
+ Email:
+ type: string
+ pattern: '^[\w\-\.]+@([\w-]+\.)+[\w-]{2,}$'
+ example: example@example.com
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yaml b/modules/openapi-generator/src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yaml
new file mode 100644
index 000000000000..9cbd0d8048a3
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yaml
@@ -0,0 +1,72 @@
+openapi: 3.0.0
+info:
+ version: 1.0.0
+ title: Example for fileNaming option
+paths:
+ /pet:
+ get:
+ tags:
+ - pet-controller
+ summary: Get a pet
+ description: ''
+ operationId: addPet
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '405':
+ description: Invalid input
+components:
+ schemas:
+ PetCategory:
+ title: Pet category
+ description: A category for a pet
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
+ xml:
+ name: Category
+ Pet:
+ title: a Pet
+ description: A pet for sale in the pet store
+ type: object
+ required:
+ - name
+ - photoUrls
+ properties:
+ id:
+ type: integer
+ format: int64
+ category:
+ $ref: '#/components/schemas/PetCategory'
+ name:
+ type: string
+ example: doggie
+ photoUrls:
+ type: array
+ xml:
+ name: photoUrl
+ wrapped: true
+ items:
+ type: string
+ status:
+ type: string
+ description: pet status in the store
+ deprecated: true
+ enum:
+ - available
+ - pending
+ - sold
+ xml:
+ name: Pet
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml b/modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml
index 1d238e672022..5877e4448fa4 100644
--- a/modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml
+++ b/modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml
@@ -969,3 +969,15 @@ components:
- Code 1
- Code 2
- Code 3
+ SimpleModelWithArrayProperty:
+ type: object
+ required:
+ - arrayOfStrings
+ properties:
+ arrayOfStrings:
+ type: array
+ items:
+ type: string
+ AllOfSimpleModel:
+ allOf:
+ - $ref: '#/components/schemas/SimpleModelWithArrayProperty'
diff --git a/pom.xml b/pom.xml
index 49dc57d3bc9b..6be189ec94af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1183,8 +1183,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
${junit.version}
test
@@ -1214,7 +1214,7 @@
11
11
- 0.23.1
+ 1.3.0
3.1.0
1.5.0
2.11.0
@@ -1227,11 +1227,11 @@
32.1.3-jre
4.3.1
2.15.2
- 2.15.3
- 2.15.3
+ 2.16.2
+ 2.16.2
0.8.10
1.15
- 4.13.2
+ 5.10.2
1.6.21
1.6.21
1.18.30
@@ -1242,7 +1242,7 @@
3.0.0
2.5.3
4.0.0-M8
- 3.0.0
+ 3.2.5
4.10.0
8.8.3
3.12.0
@@ -1252,7 +1252,7 @@
1.7.36
3.1.12.2
io.swagger.parser.v3
- 2.1.19
+ 2.1.22
7.5
1.34
3.4.3
diff --git a/samples/client/echo_api/java/apache-httpclient/pom.xml b/samples/client/echo_api/java/apache-httpclient/pom.xml
index 47a3274035b6..f5c5b09208dd 100644
--- a/samples/client/echo_api/java/apache-httpclient/pom.xml
+++ b/samples/client/echo_api/java/apache-httpclient/pom.xml
@@ -73,7 +73,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.0.0-M7
+ 3.2.5
@@ -84,7 +84,6 @@
-Xms512m -Xmx1500m
methods
10
- pertest
@@ -262,8 +261,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
${junit-version}
test
@@ -275,6 +274,6 @@
2.15.2
0.2.6
1.3.5
- 4.13.2
+ 5.10.2
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/CustomTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/CustomTest.java
index 7e0076c7e6a3..405db1ed671d 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/CustomTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/CustomTest.java
@@ -17,8 +17,8 @@
import java.util.Arrays;
import java.util.Collections;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.api.BodyApi;
import org.openapitools.client.api.QueryApi;
import org.openapitools.client.model.Category;
@@ -52,13 +52,13 @@ public void testEchoBodyPet() throws ApiException {
photoUrls( Arrays.asList( new String[] { "http://a.com", "http://b.com" } ) ).category( new Category().id( 987L ).name( "new category" ) );
final Pet p = bodyApi.testEchoBodyPet( queryObject );
- Assert.assertNotNull( p );
- Assert.assertEquals( "Hello World", p.getName() );
- Assert.assertEquals( Long.valueOf( 12345L ), p.getId() );
+ Assertions.assertNotNull( p );
+ Assertions.assertEquals( "Hello World", p.getName() );
+ Assertions.assertEquals( Long.valueOf( 12345L ), p.getId() );
// response is empty body
final Pet p2 = bodyApi.testEchoBodyPet( null );
- Assert.assertNull( p2 );
+ Assertions.assertNull( p2 );
}
/**
@@ -72,7 +72,7 @@ public void testEchoBodyPet() throws ApiException {
public void testEchoBodyPetResponseString() throws ApiException {
// response is empty body
final String p2 = bodyApi.testEchoBodyPetResponseString( null );
- Assert.assertNull( p2 );
+ Assertions.assertNull( p2 );
}
/**
@@ -89,7 +89,7 @@ public void testQueryStyleFormExplodeTrueObjectTest() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueObject( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals(
+ Assertions.assertEquals(
"/query/style_form/explode_true/object?id=12345&name=Hello%20World&category=class%20Category%20%7B%0A%20%20%20%20id%3A%20987%0A%20%20%20%20name%3A%20new%20category%0A%7D&photoUrls=http%3A%2F%2Fa.com&photoUrls=http%3A%2F%2Fb.com",
p.path );
}
@@ -106,13 +106,13 @@ public void testQueryStyleDeepObjectExplodeTrueObject() throws ApiException {
final Pet queryObject = new Pet().id( 12345L ).name( "Hello World" ).
photoUrls( Arrays.asList( new String[] { "http://a.com", "http://b.com" } ) ).category( new Category().id( 987L ).name( "new category" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"query_object[id]=12345&query_object[name]=Hello%20World&query_object[category][id]=987&query_object[category][name]=new%20category&query_object[photoUrls][0]=http%3A%2F%2Fa.com&query_object[photoUrls][1]=http%3A%2F%2Fb.com",
queryObject.toUrlQueryString( "query_object" ) );
final String response = api.testQueryStyleDeepObjectExplodeTrueObject( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals(
+ Assertions.assertEquals(
"/query/style_deepObject/explode_true/object?query_object[id]=12345&query_object[name]=Hello%20World&query_object[category][id]=987&query_object[category][name]=new%20category&query_object[photoUrls][0]=http%3A%2F%2Fa.com&query_object[photoUrls][1]=http%3A%2F%2Fb.com",
p.path );
}
@@ -132,7 +132,7 @@ public void testQueryStyleFormExplodeTrueObjectAllOfTest() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueObjectAllOf( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/query/style_form/explode_true/object/allOf?id=3487&outcomes=SKIPPED&outcomes=FAILURE&text=Hello%20World", p.path );
+ Assertions.assertEquals( "/query/style_form/explode_true/object/allOf?id=3487&outcomes=SKIPPED&outcomes=FAILURE&text=Hello%20World", p.path );
}
/**
@@ -149,7 +149,7 @@ public void testQueryStyleFormExplodeTrueArrayString() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueArrayString( q );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path );
+ Assertions.assertEquals( "/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path );
}
/**
@@ -163,44 +163,44 @@ public void testQueryStyleFormExplodeTrueArrayString() throws ApiException {
public void testQueryIntegerBooleanString() throws ApiException {
final String response = api.testQueryIntegerBooleanString( 1, true, "Hello World" );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/query/integer/boolean/string?integer_query=1&boolean_query=true&string_query=Hello%20World", p.path );
+ Assertions.assertEquals( "/query/integer/boolean/string?integer_query=1&boolean_query=true&string_query=Hello%20World", p.path );
}
@Test
public void testArrayDefaultValues() {
// test array default values
final DefaultValue d = new DefaultValue();
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
- Assert.assertEquals( d.getArrayStringDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertEquals( d.getArrayString(), Collections.emptyList() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertEquals( d.getArrayString(), Collections.emptyList() );
// test addItem
d.addArrayStringEnumDefaultItem( DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 3 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 2 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 2 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
d.addArrayStringDefaultItem( "new item" );
- Assert.assertEquals( d.getArrayStringDefault().size(), 3 );
- Assert.assertEquals( d.getArrayStringDefault().get( 2 ), "new item" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 2 ), "new item" );
d.addArrayIntegerDefaultItem( 5 );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 3 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 2 ), Integer.valueOf( 5 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 2 ), Integer.valueOf( 5 ) );
}
@@ -213,26 +213,26 @@ public void testDefaultValuesSerializationWithEmptyPayload() throws IOException
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference() {
} );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
- Assert.assertEquals( d.getArrayStringDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertEquals( d.getArrayString(), Collections.emptyList() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertEquals( d.getArrayString(), Collections.emptyList() );
- Assert.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
+ Assertions.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
"{\"array_string_enum_ref_default\":[\"success\",\"failure\"],\"array_string_enum_default\":[\"success\",\"failure\"],\"array_string_default\":[\"failure\",\"skipped\"],\"array_integer_default\":[1,3],\"array_string\":[]}" );
}
@@ -245,23 +245,23 @@ public void testDefaultValuesSerializationWithJSONString() throws IOException {
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference() {
} );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertEquals( d.getArrayString(), Collections.emptyList() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertEquals( d.getArrayString(), Collections.emptyList() );
- Assert.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
+ Assertions.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
"{\"array_string_enum_ref_default\":[\"unclassified\"],\"array_string_enum_default\":[\"unclassified\"],\"array_string_default\":[\"failure\"],\"array_integer_default\":[1,3],\"array_string\":[]}" );
}
@@ -274,9 +274,9 @@ public void testDefaultValuesSerializationWithIncorrectDefaultValues() throws IO
try {
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference() {
} );
- Assert.assertTrue( false ); // the test should not reach this line
+ Assertions.assertTrue( false ); // the test should not reach this line
} catch ( final com.fasterxml.jackson.databind.exc.ValueInstantiationException e ) {
- Assert.assertEquals( e.getMessage(),
+ Assertions.assertEquals( e.getMessage(),
"Cannot construct instance of `org.openapitools.client.model.DefaultValue$ArrayStringEnumDefaultEnum`, problem: Unexpected value 'invalid'\n" +
" at [Source: (String)\"{ \"array_string_enum_default\": [\"invalid\"] }\"; line: 1, column: 33] (through reference chain: org.openapitools.client.model.DefaultValue[\"array_string_enum_default\"]->java.util.ArrayList[0])" );
}
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/AuthApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/AuthApiTest.java
index 7fc2956fce23..81b483fa7069 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/AuthApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/AuthApiTest.java
@@ -14,9 +14,9 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -59,10 +59,10 @@ public void testAuthHttpBearerTest() throws ApiException {
String response;
api.getApiClient().setBearerToken("fixed token");
response = api.testAuthHttpBearer();
- Assert.assertTrue(response.contains("Authorization: Bearer fixed token"));
+ Assertions.assertTrue(response.contains("Authorization: Bearer fixed token"));
api.getApiClient().setBearerToken(() -> "dynamic token");
response = api.testAuthHttpBearer();
- Assert.assertTrue(response.contains("Authorization: Bearer dynamic token"));
+ Assertions.assertTrue(response.contains("Authorization: Bearer dynamic token"));
}
}
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/BodyApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/BodyApiTest.java
index 352e8e2e19bd..ef13f819e634 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/BodyApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/BodyApiTest.java
@@ -15,9 +15,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Pet;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -29,7 +29,7 @@
/**
* API tests for BodyApi
*/
-@Ignore
+@Disabled
public class BodyApiTest {
private final BodyApi api = new BodyApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/FormApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/FormApiTest.java
index 1487429390a2..a308e36d2c3e 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/FormApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/FormApiTest.java
@@ -14,9 +14,9 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -28,7 +28,7 @@
/**
* API tests for FormApi
*/
-@Ignore
+@Disabled
public class FormApiTest {
private final FormApi api = new FormApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/HeaderApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/HeaderApiTest.java
index 989c687cb7f0..3f0ec9214bf3 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/HeaderApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/HeaderApiTest.java
@@ -15,9 +15,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.StringEnumRef;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -29,7 +29,7 @@
/**
* API tests for HeaderApi
*/
-@Ignore
+@Disabled
public class HeaderApiTest {
private final HeaderApi api = new HeaderApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/PathApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/PathApiTest.java
index 5968d6614bd7..3759bdee97a6 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/PathApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/PathApiTest.java
@@ -15,9 +15,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.StringEnumRef;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -29,7 +29,7 @@
/**
* API tests for PathApi
*/
-@Ignore
+@Disabled
public class PathApiTest {
private final PathApi api = new PathApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/QueryApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/QueryApiTest.java
index 69ae8a22161c..069bf4bd3267 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/QueryApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/QueryApiTest.java
@@ -16,9 +16,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -30,7 +30,7 @@
/**
* API tests for QueryApi
*/
-@Ignore
+@Disabled
public class QueryApiTest {
private final QueryApi api = new QueryApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
index b96bf46b1053..05ea72116b86 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdTest.java
index ac9a253bb6fb..31323a96d3d3 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java
index 51804e0c14cf..e32182d690f6 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DataQueryTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DataQueryTest.java
index 9b71c406586c..7916c47947c7 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DataQueryTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DataQueryTest.java
@@ -22,9 +22,9 @@
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Query;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DefaultValueTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DefaultValueTest.java
index 8adf113d6ea2..4de417ac0324 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DefaultValueTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DefaultValueTest.java
@@ -24,9 +24,9 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
index 2d9c5b371fe3..ccc2e77abc45 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
@@ -19,9 +19,9 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java
index 2002d08bf8a7..1d5a7048a560 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java
@@ -22,9 +22,9 @@
import java.util.List;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Tag;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/QueryTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/QueryTest.java
index 266a3cb67399..48e1fbe6af98 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/QueryTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/QueryTest.java
@@ -20,9 +20,9 @@
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/StringEnumRefTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
index 81d7f918ea01..767df43f315f 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
@@ -13,9 +13,9 @@
package org.openapitools.client.model;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java
index d1d4b9de0d53..5af2a8f54cc1 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
index cdb7c02c0fd8..d5d0fc51cc1d 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for TestFormObjectMultipartRequestMarker
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
index 1fa7d643c4b5..b90b1e4cd200 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
index 82e7035a25a2..910af6a663d2 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
@@ -20,9 +20,9 @@
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/README.md b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/README.md
deleted file mode 100644
index 61555e362393..000000000000
--- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/README.md
+++ /dev/null
@@ -1,184 +0,0 @@
-# openapi-java-client
-
-OpenAPI Petstore
-- API version: 1.0.0
- - Generator version: 7.6.0-SNAPSHOT
-
-This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
-
-
-*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
-
-
-## Requirements
-
-Building the API client library requires:
-1. Java 1.8+
-2. Maven (3.8.3+)/Gradle (7.2+)
-
-## Installation
-
-To install the API client library to your local Maven repository, simply execute:
-
-```shell
-mvn clean install
-```
-
-To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
-
-```shell
-mvn clean deploy
-```
-
-Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
-
-### Maven users
-
-Add this dependency to your project's POM:
-
-```xml
-
- org.openapitools
- openapi-java-client
- 1.0.0
- compile
-
-```
-
-### Gradle users
-
-Add this dependency to your project's build file:
-
-```groovy
- repositories {
- mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central.
- mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo.
- }
-
- dependencies {
- implementation "org.openapitools:openapi-java-client:1.0.0"
- }
-```
-
-### Others
-
-At first generate the JAR by executing:
-
-```shell
-mvn clean package
-```
-
-Then manually install the following JARs:
-
-* `target/openapi-java-client-1.0.0.jar`
-* `target/lib/*.jar`
-
-## Getting Started
-
-Please follow the [installation](#installation) instruction and execute the following Java code:
-
-```java
-
-// Import classes:
-import org.openapitools.client.ApiClient;
-import org.openapitools.client.ApiException;
-import org.openapitools.client.Configuration;
-import org.openapitools.client.auth.*;
-import org.openapitools.client.models.*;
-import org.openapitools.client.api.PetApi;
-
-public class Example {
- public static void main(String[] args) {
- ApiClient defaultClient = Configuration.getDefaultApiClient();
- defaultClient.setBasePath("http://petstore.swagger.io/v2");
-
- // Configure OAuth2 access token for authorization: petstore_auth
- OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
- petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
-
- PetApi apiInstance = new PetApi(defaultClient);
- Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
- try {
- Pet result = apiInstance.addPet(pet);
- System.out.println(result);
- } catch (ApiException e) {
- System.err.println("Exception when calling PetApi#addPet");
- System.err.println("Status code: " + e.getCode());
- System.err.println("Reason: " + e.getResponseBody());
- System.err.println("Response headers: " + e.getResponseHeaders());
- e.printStackTrace();
- }
- }
-}
-
-```
-
-## Documentation for API Endpoints
-
-All URIs are relative to *http://petstore.swagger.io/v2*
-
-Class | Method | HTTP request | Description
------------- | ------------- | ------------- | -------------
-*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
-*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
-*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
-*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
-*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
-*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
-*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
-*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
-*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
-*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
-*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
-*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
-*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
-*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
-*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
-*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
-*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
-*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
-*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
-*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
-
-
-## Documentation for Models
-
- - [Category](docs/Category.md)
- - [ModelApiResponse](docs/ModelApiResponse.md)
- - [Order](docs/Order.md)
- - [Pet](docs/Pet.md)
- - [Tag](docs/Tag.md)
- - [User](docs/User.md)
-
-
-
-## Documentation for Authorization
-
-
-Authentication schemes defined for the API:
-
-### petstore_auth
-
-- **Type**: OAuth
-- **Flow**: implicit
-- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
-- **Scopes**:
- - write:pets: modify pets in your account
- - read:pets: read your pets
-
-
-### api_key
-
-- **Type**: API key
-- **API key parameter name**: api_key
-- **Location**: HTTP header
-
-
-## Recommendation
-
-It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
-
-## Author
-
-
-
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/build.gradle b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/build.gradle
index 2e7658f2f33d..2fc16aeeb5c6 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/build.gradle
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/build.gradle
@@ -2,15 +2,14 @@ group 'org.openapitools'
version '1.0.0'
wrapper {
- gradleVersion = '7.5'
+ gradleVersion = '8.7'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
buildscript {
- ext.kotlin_version = '1.8.10'
- ext.spring_boot_version = "3.2.4"
- // 6.13.0 is the latest stable release that supports JDK8
- ext.spotless_version = "6.13.0"
+ ext.kotlin_version = '1.9.23'
+ ext.spring_boot_version = "3.2.5"
+ ext.spotless_version = "6.25.0"
repositories {
maven { url "https://repo1.maven.org/maven2" }
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar
index c1962a79e29d..d64cd4917707 100644
Binary files a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties
index 8707e8b5067f..e7646dead063 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew
index aeb74cbb43e3..9d0ce634cb11 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew
@@ -69,34 +69,35 @@ 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" ]
+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
+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##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+# 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 "$*"
+echo "$*"
} >&2
die () {
- echo
- echo "$*"
- echo
- exit 1
+echo
+echo "$*"
+echo
+exit 1
} >&2
# OS specific support (must be 'true' or 'false').
@@ -105,10 +106,10 @@ msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
- CYGWIN* ) cygwin=true ;; #(
- Darwin* ) darwin=true ;; #(
- MSYS* | MINGW* ) msys=true ;; #(
- NONSTOP* ) nonstop=true ;;
+CYGWIN* ) cygwin=true ;; #(
+Darwin* ) darwin=true ;; #(
+MSYS* | MINGW* ) msys=true ;; #(
+NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -116,43 +117,46 @@ 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
+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
+fi
else
- JAVACMD=java
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+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=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=SC3045
- ulimit -n "$MAX_FD" ||
- warn "Could not set maximum file descriptor limit to $MAX_FD"
- esac
+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:
@@ -165,55 +169,55 @@ fi
# 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
+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, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+# 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 \
- "$@"
+"-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"
+die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
@@ -236,10 +240,10 @@ fi
#
eval "set -- $(
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
- xargs -n1 |
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
- tr '\n' ' '
- )" '"$@"'
+printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+xargs -n1 |
+sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+tr '\n' ' '
+)" '"$@"'
exec "$JAVACMD" "$@"
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew.bat b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew.bat
index 93e3f59f135d..9d0ce634cb11 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew.bat
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew.bat
@@ -1,92 +1,249 @@
-@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.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-: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
+#!/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/echo_api/kotlin-jvm-spring-3-restclient/settings.gradle b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/settings.gradle
index 854d039d418c..431927491c34 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/settings.gradle
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/settings.gradle
@@ -1,2 +1 @@
-
rootProject.name = 'kotlin-client'
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/build.gradle b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/build.gradle
index 2e7658f2f33d..99192219a9d1 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/build.gradle
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/build.gradle
@@ -2,15 +2,14 @@ group 'org.openapitools'
version '1.0.0'
wrapper {
- gradleVersion = '7.5'
+ gradleVersion = '8.7'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
buildscript {
- ext.kotlin_version = '1.8.10'
- ext.spring_boot_version = "3.2.4"
- // 6.13.0 is the latest stable release that supports JDK8
- ext.spotless_version = "6.13.0"
+ ext.kotlin_version = '1.9.23'
+ ext.spring_boot_version = "3.2.5"
+ ext.spotless_version = "6.25.0"
repositories {
maven { url "https://repo1.maven.org/maven2" }
@@ -59,11 +58,13 @@ kotlin {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
+
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.17.0"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.0"
- implementation "org.springframework.boot:spring-boot-starter-web:$spring_boot_version"
+ implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
+ implementation "io.projectreactor:reactor-core:3.6.5"
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
}
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.jar
index c1962a79e29d..d64cd4917707 100644
Binary files a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.properties
index 8707e8b5067f..e7646dead063 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.properties
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradlew b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradlew
index aeb74cbb43e3..9d0ce634cb11 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradlew
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradlew
@@ -69,34 +69,35 @@ 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" ]
+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
+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##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+# 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 "$*"
+echo "$*"
} >&2
die () {
- echo
- echo "$*"
- echo
- exit 1
+echo
+echo "$*"
+echo
+exit 1
} >&2
# OS specific support (must be 'true' or 'false').
@@ -105,10 +106,10 @@ msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
- CYGWIN* ) cygwin=true ;; #(
- Darwin* ) darwin=true ;; #(
- MSYS* | MINGW* ) msys=true ;; #(
- NONSTOP* ) nonstop=true ;;
+CYGWIN* ) cygwin=true ;; #(
+Darwin* ) darwin=true ;; #(
+MSYS* | MINGW* ) msys=true ;; #(
+NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -116,43 +117,46 @@ 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
+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
+fi
else
- JAVACMD=java
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+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=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=SC3045
- ulimit -n "$MAX_FD" ||
- warn "Could not set maximum file descriptor limit to $MAX_FD"
- esac
+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:
@@ -165,55 +169,55 @@ fi
# 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
+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, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+# 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 \
- "$@"
+"-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"
+die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
@@ -236,10 +240,10 @@ fi
#
eval "set -- $(
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
- xargs -n1 |
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
- tr '\n' ' '
- )" '"$@"'
+printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+xargs -n1 |
+sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+tr '\n' ' '
+)" '"$@"'
exec "$JAVACMD" "$@"
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradlew.bat b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradlew.bat
index 93e3f59f135d..9d0ce634cb11 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradlew.bat
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/gradlew.bat
@@ -1,92 +1,249 @@
-@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.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-: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
+#!/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/echo_api/kotlin-jvm-spring-3-webclient/settings.gradle b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/settings.gradle
index 854d039d418c..431927491c34 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/settings.gradle
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/settings.gradle
@@ -1,2 +1 @@
-
rootProject.name = 'kotlin-client'
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt
index cc3e26512b0a..1b2741752687 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt
@@ -17,33 +17,37 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty
-import org.springframework.web.client.RestClient
-import org.springframework.web.client.RestClientResponseException
-
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
+import org.springframework.web.reactive.function.client.WebClient
+import org.springframework.web.reactive.function.client.WebClientResponseException
+import org.springframework.http.codec.json.Jackson2JsonDecoder
+import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType
-
+import reactor.core.publisher.Mono
+import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.infrastructure.*
-class AuthApi(client: RestClient) : ApiClient(client) {
+class AuthApi(client: WebClient) : ApiClient(client) {
- constructor(baseUrl: String) : this(RestClient.builder()
+ constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl)
- .messageConverters { it.add(MappingJackson2HttpMessageConverter()) }
+ .codecs {
+ it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ }
.build()
)
- @Throws(RestClientResponseException::class)
- fun testAuthHttpBasic(): kotlin.String {
- val result = testAuthHttpBasicWithHttpInfo()
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testAuthHttpBasic(): Mono {
+ return testAuthHttpBasicWithHttpInfo()
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testAuthHttpBasicWithHttpInfo(): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testAuthHttpBasicWithHttpInfo(): Mono> {
val localVariableConfig = testAuthHttpBasicRequestConfig()
return request(
localVariableConfig
@@ -71,14 +75,14 @@ class AuthApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testAuthHttpBearer(): kotlin.String {
- val result = testAuthHttpBearerWithHttpInfo()
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testAuthHttpBearer(): Mono {
+ return testAuthHttpBearerWithHttpInfo()
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testAuthHttpBearerWithHttpInfo(): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testAuthHttpBearerWithHttpInfo(): Mono> {
val localVariableConfig = testAuthHttpBearerRequestConfig()
return request(
localVariableConfig
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt
index 44ca769307d2..49d9a5840be5 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt
@@ -17,35 +17,39 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty
-import org.springframework.web.client.RestClient
-import org.springframework.web.client.RestClientResponseException
-
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
+import org.springframework.web.reactive.function.client.WebClient
+import org.springframework.web.reactive.function.client.WebClientResponseException
+import org.springframework.http.codec.json.Jackson2JsonDecoder
+import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType
-
+import reactor.core.publisher.Mono
+import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.models.Pet
import org.openapitools.client.models.Tag
import org.openapitools.client.infrastructure.*
-class BodyApi(client: RestClient) : ApiClient(client) {
+class BodyApi(client: WebClient) : ApiClient(client) {
- constructor(baseUrl: String) : this(RestClient.builder()
+ constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl)
- .messageConverters { it.add(MappingJackson2HttpMessageConverter()) }
+ .codecs {
+ it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ }
.build()
)
- @Throws(RestClientResponseException::class)
- fun testBinaryGif(): java.io.File {
- val result = testBinaryGifWithHttpInfo()
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testBinaryGif(): Mono {
+ return testBinaryGifWithHttpInfo()
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testBinaryGifWithHttpInfo(): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testBinaryGifWithHttpInfo(): Mono> {
val localVariableConfig = testBinaryGifRequestConfig()
return request(
localVariableConfig
@@ -73,14 +77,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testBodyApplicationOctetstreamBinary(body: java.io.File? = null): kotlin.String {
- val result = testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testBodyApplicationOctetstreamBinary(body: java.io.File? = null): Mono {
+ return testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File? = null): Mono> {
val localVariableConfig = testBodyApplicationOctetstreamBinaryRequestConfig(body = body)
return request(
localVariableConfig
@@ -109,14 +113,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testBodyMultipartFormdataArrayOfBinary(files: kotlin.collections.List): kotlin.String {
- val result = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testBodyMultipartFormdataArrayOfBinary(files: kotlin.collections.List): Mono {
+ return testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List): Mono> {
val localVariableConfig = testBodyMultipartFormdataArrayOfBinaryRequestConfig(files = files)
return request>, kotlin.String>(
localVariableConfig
@@ -145,14 +149,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testBodyMultipartFormdataSingleBinary(myFile: java.io.File? = null): kotlin.String {
- val result = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testBodyMultipartFormdataSingleBinary(myFile: java.io.File? = null): Mono {
+ return testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File? = null): Mono> {
val localVariableConfig = testBodyMultipartFormdataSingleBinaryRequestConfig(myFile = myFile)
return request>, kotlin.String>(
localVariableConfig
@@ -181,14 +185,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testEchoBodyFreeFormObjectResponseString(body: kotlin.Any? = null): kotlin.String {
- val result = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testEchoBodyFreeFormObjectResponseString(body: kotlin.Any? = null): Mono {
+ return testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any? = null): Mono> {
val localVariableConfig = testEchoBodyFreeFormObjectResponseStringRequestConfig(body = body)
return request(
localVariableConfig
@@ -217,14 +221,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testEchoBodyPet(pet: Pet? = null): Pet {
- val result = testEchoBodyPetWithHttpInfo(pet = pet)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testEchoBodyPet(pet: Pet? = null): Mono {
+ return testEchoBodyPetWithHttpInfo(pet = pet)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testEchoBodyPetWithHttpInfo(pet: Pet? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testEchoBodyPetWithHttpInfo(pet: Pet? = null): Mono> {
val localVariableConfig = testEchoBodyPetRequestConfig(pet = pet)
return request(
localVariableConfig
@@ -253,14 +257,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testEchoBodyPetResponseString(pet: Pet? = null): kotlin.String {
- val result = testEchoBodyPetResponseStringWithHttpInfo(pet = pet)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testEchoBodyPetResponseString(pet: Pet? = null): Mono {
+ return testEchoBodyPetResponseStringWithHttpInfo(pet = pet)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testEchoBodyPetResponseStringWithHttpInfo(pet: Pet? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testEchoBodyPetResponseStringWithHttpInfo(pet: Pet? = null): Mono> {
val localVariableConfig = testEchoBodyPetResponseStringRequestConfig(pet = pet)
return request(
localVariableConfig
@@ -289,14 +293,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testEchoBodyTagResponseString(tag: Tag? = null): kotlin.String {
- val result = testEchoBodyTagResponseStringWithHttpInfo(tag = tag)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testEchoBodyTagResponseString(tag: Tag? = null): Mono {
+ return testEchoBodyTagResponseStringWithHttpInfo(tag = tag)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testEchoBodyTagResponseStringWithHttpInfo(tag: Tag? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testEchoBodyTagResponseStringWithHttpInfo(tag: Tag? = null): Mono> {
val localVariableConfig = testEchoBodyTagResponseStringRequestConfig(tag = tag)
return request(
localVariableConfig
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt
index c45ae1a23b65..7182da46e83c 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt
@@ -17,33 +17,37 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty
-import org.springframework.web.client.RestClient
-import org.springframework.web.client.RestClientResponseException
-
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
+import org.springframework.web.reactive.function.client.WebClient
+import org.springframework.web.reactive.function.client.WebClientResponseException
+import org.springframework.http.codec.json.Jackson2JsonDecoder
+import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType
-
+import reactor.core.publisher.Mono
+import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.infrastructure.*
-class FormApi(client: RestClient) : ApiClient(client) {
+class FormApi(client: WebClient) : ApiClient(client) {
- constructor(baseUrl: String) : this(RestClient.builder()
+ constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl)
- .messageConverters { it.add(MappingJackson2HttpMessageConverter()) }
+ .codecs {
+ it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ }
.build()
)
- @Throws(RestClientResponseException::class)
- fun testFormIntegerBooleanString(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): kotlin.String {
- val result = testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testFormIntegerBooleanString(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): Mono {
+ return testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): Mono> {
val localVariableConfig = testFormIntegerBooleanStringRequestConfig(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
return request>, kotlin.String>(
localVariableConfig
@@ -74,14 +78,14 @@ class FormApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testFormOneof(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): kotlin.String {
- val result = testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testFormOneof(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): Mono {
+ return testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testFormOneofWithHttpInfo(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testFormOneofWithHttpInfo(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): Mono> {
val localVariableConfig = testFormOneofRequestConfig(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
return request>, kotlin.String>(
localVariableConfig
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt
index ce7a48355e8e..b21a449f9037 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt
@@ -17,22 +17,26 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty
-import org.springframework.web.client.RestClient
-import org.springframework.web.client.RestClientResponseException
-
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
+import org.springframework.web.reactive.function.client.WebClient
+import org.springframework.web.reactive.function.client.WebClientResponseException
+import org.springframework.http.codec.json.Jackson2JsonDecoder
+import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType
-
+import reactor.core.publisher.Mono
+import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.models.StringEnumRef
import org.openapitools.client.infrastructure.*
-class HeaderApi(client: RestClient) : ApiClient(client) {
+class HeaderApi(client: WebClient) : ApiClient(client) {
- constructor(baseUrl: String) : this(RestClient.builder()
+ constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl)
- .messageConverters { it.add(MappingJackson2HttpMessageConverter()) }
+ .codecs {
+ it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ }
.build()
)
@@ -46,14 +50,14 @@ class HeaderApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): kotlin.String {
- val result = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): Mono {
+ return testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): Mono> {
val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
return request(
localVariableConfig
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt
index f1af5bd244a8..062e0a6c403d 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt
@@ -17,22 +17,26 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty
-import org.springframework.web.client.RestClient
-import org.springframework.web.client.RestClientResponseException
-
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
+import org.springframework.web.reactive.function.client.WebClient
+import org.springframework.web.reactive.function.client.WebClientResponseException
+import org.springframework.http.codec.json.Jackson2JsonDecoder
+import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType
-
+import reactor.core.publisher.Mono
+import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.models.StringEnumRef
import org.openapitools.client.infrastructure.*
-class PathApi(client: RestClient) : ApiClient(client) {
+class PathApi(client: WebClient) : ApiClient(client) {
- constructor(baseUrl: String) : this(RestClient.builder()
+ constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl)
- .messageConverters { it.add(MappingJackson2HttpMessageConverter()) }
+ .codecs {
+ it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ }
.build()
)
@@ -46,14 +50,14 @@ class PathApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): kotlin.String {
- val result = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): Mono {
+ return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): Mono> {
val localVariableConfig = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
return request(
localVariableConfig
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt
index 3b2b78ffec98..dc2d0bb902d1 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt
@@ -17,24 +17,28 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty
-import org.springframework.web.client.RestClient
-import org.springframework.web.client.RestClientResponseException
-
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
+import org.springframework.web.reactive.function.client.WebClient
+import org.springframework.web.reactive.function.client.WebClientResponseException
+import org.springframework.http.codec.json.Jackson2JsonDecoder
+import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType
-
+import reactor.core.publisher.Mono
+import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.models.Pet
import org.openapitools.client.models.StringEnumRef
import org.openapitools.client.models.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
import org.openapitools.client.infrastructure.*
-class QueryApi(client: RestClient) : ApiClient(client) {
+class QueryApi(client: WebClient) : ApiClient(client) {
- constructor(baseUrl: String) : this(RestClient.builder()
+ constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl)
- .messageConverters { it.add(MappingJackson2HttpMessageConverter()) }
+ .codecs {
+ it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
+ }
.build()
)
@@ -48,14 +52,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testEnumRefString(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): kotlin.String {
- val result = testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testEnumRefString(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): Mono {
+ return testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): Mono> {
val localVariableConfig = testEnumRefStringRequestConfig(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
return request(
localVariableConfig
@@ -91,14 +95,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testQueryDatetimeDateString(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): kotlin.String {
- val result = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testQueryDatetimeDateString(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): Mono {
+ return testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): Mono> {
val localVariableConfig = testQueryDatetimeDateStringRequestConfig(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
return request(
localVariableConfig
@@ -137,14 +141,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testQueryIntegerBooleanString(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): kotlin.String {
- val result = testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testQueryIntegerBooleanString(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): Mono {
+ return testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): Mono> {
val localVariableConfig = testQueryIntegerBooleanStringRequestConfig(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
return request(
localVariableConfig
@@ -183,14 +187,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: Pet? = null): kotlin.String {
- val result = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: Pet? = null): Mono {
+ return testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): Mono> {
val localVariableConfig = testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject = queryObject)
return request(
localVariableConfig
@@ -223,14 +227,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testQueryStyleFormExplodeTrueArrayString(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): kotlin.String {
- val result = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testQueryStyleFormExplodeTrueArrayString(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): Mono {
+ return testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): Mono> {
val localVariableConfig = testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject = queryObject)
return request(
localVariableConfig
@@ -263,14 +267,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
}
- @Throws(RestClientResponseException::class)
- fun testQueryStyleFormExplodeTrueObject(queryObject: Pet? = null): kotlin.String {
- val result = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
- return result.body!!
+ @Throws(WebClientResponseException::class)
+ fun testQueryStyleFormExplodeTrueObject(queryObject: Pet? = null): Mono {
+ return testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
+ .map { it.body }
}
- @Throws(RestClientResponseException::class)
- fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): ResponseEntity {
+ @Throws(WebClientResponseException::class)
+ fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): Mono> {
val localVariableConfig = testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject = queryObject)
return request(
localVariableConfig
diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
index 64f843ed93be..b8acccd3de12 100644
--- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
+++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
@@ -4,13 +4,14 @@ import org.springframework.core.ParameterizedTypeReference
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
import org.springframework.http.MediaType
-import org.springframework.web.client.RestClient
+import org.springframework.web.reactive.function.client.WebClient
import org.springframework.http.ResponseEntity
import org.springframework.util.LinkedMultiValueMap
+import reactor.core.publisher.Mono
-open class ApiClient(protected val client: RestClient) {
+open class ApiClient(protected val client: WebClient) {
- protected inline fun request(requestConfig: RequestConfig): ResponseEntity {
+ protected inline fun request(requestConfig: RequestConfig): Mono> {
return prepare(defaults(requestConfig))
.retrieve()
.toEntity(object : ParameterizedTypeReference() {})
@@ -20,7 +21,7 @@ open class ApiClient(protected val client: RestClient) {
client.method(requestConfig)
.uri(requestConfig)
.headers(requestConfig)
- .nullableBody(requestConfig)
+ .body(requestConfig)
protected fun defaults(requestConfig: RequestConfig) =
requestConfig.apply {
@@ -32,10 +33,10 @@ open class ApiClient(protected val client: RestClient) {
}
}
- private fun RestClient.method(requestConfig: RequestConfig)=
+ private fun WebClient.method(requestConfig: RequestConfig)=
method(HttpMethod.valueOf(requestConfig.method.name))
- private fun RestClient.RequestBodyUriSpec.uri(requestConfig: RequestConfig