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/java-resttemplate.yaml b/bin/configs/java-resttemplate.yaml index cedcc574dbb3..9d8bec574615 100644 --- a/bin/configs/java-resttemplate.yaml +++ b/bin/configs/java-resttemplate.yaml @@ -9,3 +9,4 @@ additionalProperties: java8: true containerDefaultToNull: true generateConstructorWithAllArgs: true + generateBuilders: true 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/spring-boot-3.yaml b/bin/configs/spring-boot-3.yaml index 6096b1a50e10..472f660ac7ab 100644 --- a/bin/configs/spring-boot-3.yaml +++ b/bin/configs/spring-boot-3.yaml @@ -12,3 +12,4 @@ additionalProperties: withXml: true hideGenerationTimestamp: "true" generateConstructorWithAllArgs: true + generateBuilders: true diff --git a/bin/configs/spring-boot-lombok-data.yaml b/bin/configs/spring-boot-lombok-data.yaml index 51939d31d54d..57f54d71d3db 100644 --- a/bin/configs/spring-boot-lombok-data.yaml +++ b/bin/configs/spring-boot-lombok-data.yaml @@ -8,3 +8,4 @@ additionalProperties: hideGenerationTimestamp: "true" additionalModelTypeAnnotations: "@lombok.Data;@lombok.Builder;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor" generateConstructorWithAllArgs: true + generateBuilders: true diff --git a/bin/configs/spring-boot-lombok-tostring.yaml b/bin/configs/spring-boot-lombok-tostring.yaml index 35d4e934eb82..5a7723d95f25 100644 --- a/bin/configs/spring-boot-lombok-tostring.yaml +++ b/bin/configs/spring-boot-lombok-tostring.yaml @@ -9,3 +9,4 @@ additionalProperties: performBeanValidation: "true" useSpringBoot3: "true" additionalModelTypeAnnotations: "@lombok.Getter;@lombok.Setter;@lombok.ToString;@lombok.EqualsAndHashCode" + generateBuilders: true diff --git a/bin/configs/spring-boot-oneof.yaml b/bin/configs/spring-boot-oneof.yaml index a986fc8fabe3..f4a7ca7a99cc 100644 --- a/bin/configs/spring-boot-oneof.yaml +++ b/bin/configs/spring-boot-oneof.yaml @@ -8,3 +8,4 @@ additionalProperties: artifactId: springboot-oneof snapshotVersion: "true" hideGenerationTimestamp: "true" + generateBuilders: true diff --git a/bin/configs/spring-boot-useoptional.yaml b/bin/configs/spring-boot-useoptional.yaml index 2b3dbdc1a864..82530260d677 100644 --- a/bin/configs/spring-boot-useoptional.yaml +++ b/bin/configs/spring-boot-useoptional.yaml @@ -8,3 +8,4 @@ additionalProperties: useOptional: true artifactId: spring-boot-useoptional hideGenerationTimestamp: "true" + generateBuilders: 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/fsharp-functions.md b/docs/generators/fsharp-functions.md index a20382152aab..33bd1f1c2922 100644 --- a/docs/generators/fsharp-functions.md +++ b/docs/generators/fsharp-functions.md @@ -34,7 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |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| |OpenAPI/src| +|sourceFolder|source folder for generated code| |OpenAPI\src| ## IMPORT MAPPING diff --git a/docs/generators/fsharp-giraffe-server.md b/docs/generators/fsharp-giraffe-server.md index abe079e504fa..fb3e25b3d776 100644 --- a/docs/generators/fsharp-giraffe-server.md +++ b/docs/generators/fsharp-giraffe-server.md @@ -30,7 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |packageVersion|F# package version.| |1.0.0| |returnICollection|Return ICollection<T> instead of the concrete type.| |false| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| -|sourceFolder|source folder for generated code| |OpenAPI/src| +|sourceFolder|source folder for generated code| |OpenAPI\src| |useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false| |useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false| |useSwashbuckle|Uses the Swashbuckle.AspNetCore NuGet package for documentation.| |false| diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index f4d30d839d0f..12bc9a24ae90 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index e1b5c883da21..1c7efa14ec82 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -55,6 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/java-helidon-client.md b/docs/generators/java-helidon-client.md index 0e88003e8603..25a6eab72efa 100644 --- a/docs/generators/java-helidon-client.md +++ b/docs/generators/java-helidon-client.md @@ -38,6 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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| |fullProject|If set to true, it will generate all files; if set to false, it will only generate API files. If unspecified, the behavior depends on whether a project exists or not: if it does not, same as true; if it does, same as false. Note that test files are never overwritten.| || +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |helidonVersion|Helidon version for generated code| |3.0.1| diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md index bb21f053b44f..7f1973573f5d 100644 --- a/docs/generators/java-helidon-server.md +++ b/docs/generators/java-helidon-server.md @@ -37,6 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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| |fullProject|If set to true, it will generate all files; if set to false, it will only generate API files. If unspecified, the behavior depends on whether a project exists or not: if it does not, same as true; if it does, same as false. Note that test files are never overwritten.| || +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |gradleProject|Whether to generate gradle project instead of maven.| |false| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index ef93ebfa9478..cbad3716eb2c 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| @@ -64,7 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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/gen/java| +|sourceFolder|source folder for generated code| |src\gen\java| |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |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| diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md index 5a02be5ce719..f8c968280ec4 100644 --- a/docs/generators/java-micronaut-client.md +++ b/docs/generators/java-micronaut-client.md @@ -50,6 +50,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateOperationOnlyForFirstTag|When false, the operation method will be duplicated in each of the tags if multiple tags are assigned to this operation. If true, each operation will be generated only once in the first assigned tag.| |false| |generateSwaggerAnnotations|Specify if you want to generate swagger annotations and which version|
**swagger2**
Use io.swagger.core.v3:swagger-annotations for annotating operations and schemas
**true**
Equivalent to "swagger2"
**false**
Do not generate swagger annotations
**swagger1**
Use io.swagger:swagger-annotations for annotating operations and schemas
|false| diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md index dbf99b6d81d8..9cb2ad4dbbcb 100644 --- a/docs/generators/java-micronaut-server.md +++ b/docs/generators/java-micronaut-server.md @@ -45,6 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateControllerAsAbstract|Generate an abstract class for controller to be extended. (apiPackage is then used for the abstract class, and controllerPackage is used for implementation that extends it.)| |false| |generateControllerFromExamples|Generate the implementation of controller and tests from parameter and return examples that will verify that the api works as desired (for testing)| |false| 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/java-msf4j.md b/docs/generators/java-msf4j.md index ee7ede5d0829..52455c5fea16 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index 074ba58ea946..6ecb576ac901 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -43,6 +43,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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| |eurekaUri|Eureka URI| |null| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |com.prokarma| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 91206d35863c..bfdef88970f0 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -44,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |handleExceptions|Add a 'throw exception' to each controller function. Add also a custom error handler where you can put your custom logic| |true| diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 7bbf2cc6f183..202f013209d0 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index 65af14ea9dc6..3144df23e1a1 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 8456d54beaab..4592996516e1 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-wiremock.md b/docs/generators/java-wiremock.md index 91d46a8c3cb4..1ae178f9927c 100644 --- a/docs/generators/java-wiremock.md +++ b/docs/generators/java-wiremock.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java.md b/docs/generators/java.md index ec129553181c..905ddd214eed 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -48,6 +48,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index f62da7ca428d..f990de40ddb6 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -41,7 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| -|generateBuilders|Whether to generate builders for models.| |false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generatePom|Whether to generate pom.xml if the file does not already exist.| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index e71f240e8766..fc673af03f33 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| @@ -64,7 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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/gen/java| +|sourceFolder|source folder for generated code| |src\gen\java| |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.| |false| |useBeanValidation|Use BeanValidation API annotations| |false| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index 401db4e918ea..f72c477c3b73 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |false| |generateNonSpringApplication|Generate non-Spring application| |false| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index d0a73f242178..89caf27c7ad3 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |false| |generateNonSpringApplication|Generate non-Spring application| |false| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 81af0a811e18..d3b30f001e46 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 50bd75bc9297..8645361f8435 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index 7204ab79be76..af6e8c0aa2dd 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |false| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 1d45f8a1a192..f1ff6d31bb66 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -41,7 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |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| -|generateBuilders|Whether to generate builders for models.| |false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generatePom|Whether to generate pom.xml if the file does not already exist.| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 9bf9b50cfda0..6ae3b647ac67 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -48,6 +48,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |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| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md index 519ad121b837..4bfb9b4d3778 100644 --- a/docs/generators/swift5.md +++ b/docs/generators/swift5.md @@ -48,13 +48,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl |responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine, AsyncAwait are available.| |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| -|swiftPackagePath|Set a custom source path instead of OpenAPIClient/Classes/OpenAPIs.| |null| +|swiftPackagePath|Set a custom source path instead of OpenAPIClient\Classes\OpenAPIs.| |null| |swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null| |useBacktickEscapes|Escape reserved words using backticks (default: false)| |false| |useClasses|Use final classes for models instead of structs (default: false)| |false| |useCustomDateWithoutTime|Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)| |false| |useJsonEncodable|Make models conform to JSONEncodable protocol (default: true)| |true| -|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null| +|useSPMFileStructure|Use SPM file structure and set the source path to Sources\{{projectName}} (default: false).| |null| |validatable|Make validation rules and validator for model properies (default: true)| |true| ## IMPORT MAPPING 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/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 7e8a93d919f0..64e228283414 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -95,7 +95,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String LOMBOK = "lombok"; public static final String DEFAULT_TEST_FOLDER = "${project.build.directory}/generated-test-sources/openapi"; public static final String GENERATE_CONSTRUCTOR_WITH_ALL_ARGS = "generateConstructorWithAllArgs"; - + public static final String GENERATE_BUILDERS = "generateBuilders"; protected String dateLibrary = "java8"; protected boolean supportAsync = false; protected boolean withXml = false; @@ -145,6 +145,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code protected boolean useJakartaEe = false; protected boolean containerDefaultToNull = false; protected boolean generateConstructorWithAllArgs = false; + protected boolean generateBuilder = false; private Map schemaKeyToModelNameCache = new HashMap<>(); public AbstractJavaCodegen() { @@ -285,6 +286,7 @@ public AbstractJavaCodegen() { cliOptions.add(CliOption.newBoolean(USE_JAKARTA_EE, "whether to use Jakarta EE namespace instead of javax")); cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null")); cliOptions.add(CliOption.newBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, "whether to generate a constructor for all arguments").defaultValue(Boolean.FALSE.toString())); + cliOptions.add(CliOption.newBoolean(GENERATE_BUILDERS, "Whether to generate builders for models").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); @@ -359,10 +361,14 @@ public void processOpts() { } if (additionalProperties.containsKey(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS)) { - this.setgenerateConstructorWithAllArgs(convertPropertyToBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS)); + this.setGenerateConstructorWithAllArgs(convertPropertyToBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS)); } writePropertyBack(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, generateConstructorWithAllArgs); + if (additionalProperties.containsKey(GENERATE_BUILDERS)) { + this.setGenerateBuilder(convertPropertyToBoolean(GENERATE_BUILDERS)); + } + writePropertyBack(GENERATE_BUILDERS, generateBuilder); if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) { LOGGER.info("Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); @@ -684,14 +690,22 @@ public void processOpts() { }); } - public void setgenerateConstructorWithAllArgs(boolean aValue) { + public void setGenerateConstructorWithAllArgs(boolean aValue) { this.generateConstructorWithAllArgs = aValue; } - public boolean isgenerateConstructorWithAllArgs() { + public boolean isGenerateConstructorWithAllArgs() { return generateConstructorWithAllArgs; } + public void setGenerateBuilder(boolean aValue) { + this.generateBuilder = aValue; + } + + public boolean isGenerateBuilder() { + return generateBuilder; + } + /** * Analyse and post process all Models. * @param objs the models map. @@ -777,7 +791,7 @@ public Map postProcessAllModels(Map objs) } } - if (isgenerateConstructorWithAllArgs()) { + if (isGenerateConstructorWithAllArgs()) { // conditionally force the generation of all args constructor. for (CodegenModel cm : allModels.values()) { if (isConstructorWithAllArgsAllowed(cm)) { 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/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index 373ac795d862..918fb873e170 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -40,7 +40,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String USE_MICROPROFILE_OPENAPI_ANNOTATIONS = "useMicroProfileOpenAPIAnnotations"; public static final String USE_MUTINY = "useMutiny"; public static final String OPEN_API_SPEC_FILE_LOCATION = "openApiSpecFileLocation"; - public static final String GENERATE_BUILDERS = "generateBuilders"; public static final String QUARKUS_LIBRARY = "quarkus"; public static final String THORNTAIL_LIBRARY = "thorntail"; @@ -115,7 +114,6 @@ public JavaJAXRSSpecServerCodegen() { cliOptions.add(library); cliOptions.add(CliOption.newBoolean(GENERATE_POM, "Whether to generate pom.xml if the file does not already exist.").defaultValue(String.valueOf(generatePom))); - cliOptions.add(CliOption.newBoolean(GENERATE_BUILDERS, "Whether to generate builders for models.").defaultValue(String.valueOf(generateBuilders))); cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.").defaultValue(String.valueOf(interfaceOnly))); cliOptions.add(CliOption.newBoolean(RETURN_RESPONSE, "Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.").defaultValue(String.valueOf(returnResponse))); cliOptions.add(CliOption.newBoolean(USE_SWAGGER_ANNOTATIONS, "Whether to generate Swagger annotations.", useSwaggerAnnotations)); 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/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index fb225cf6e58e..bb241bf05014 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -1170,7 +1170,7 @@ public CodegenModel fromModel(String name, Schema model) { @Override protected boolean isConstructorWithAllArgsAllowed(CodegenModel codegenModel) { - if (lombokAnnotations != null && lombokAnnotations.containsKey("allArgsConstructor")) { + if (lombokAnnotations != null && lombokAnnotations.containsKey("AllArgsConstructor")) { // constructor generated by lombok return false; } @@ -1306,6 +1306,21 @@ private Set reformatProvideArgsParams(Operation operation) { return provideArgsClassSet; } + @Override + public Map postProcessAllModels(Map objs) { + objs = super.postProcessAllModels(objs); + + Map allModels = getAllModels(objs); + // conditionally force the generation of no args constructor + for (CodegenModel cm : allModels.values()) { + boolean hasLombokNoArgsConstructor = lombokAnnotations != null && lombokAnnotations.containsKey("NoArgsConstructor"); + if (!hasLombokNoArgsConstructor + && (cm.hasRequired || cm.vendorExtensions.containsKey("x-java-all-args-constructor"))) { + cm.vendorExtensions.put("x-java-no-args-constructor", true); + } + } + return objs; + } @Override public ModelsMap postProcessModelsEnum(ModelsMap objs) { 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/javaBuilder.mustache b/modules/openapi-generator/src/main/resources/Java/javaBuilder.mustache new file mode 100644 index 000000000000..c02730081ca9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/javaBuilder.mustache @@ -0,0 +1,82 @@ +public static class Builder {{#parentModel}}extends {{classname}}.Builder {{/parentModel}}{ + + private {{classname}} instance; + + public Builder() { + this(new {{classname}}()); + } + + protected Builder({{classname}} instance) { + {{#parentModel}} + super(instance); + {{/parentModel}} + this.instance = instance; + } + + {{#vars}} + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.instance.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.instance.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{#vendorExtensions.x-is-jackson-optional-nullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{name}} = {{name}}; + return this; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{/vars}} + +{{#parentVars}} + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { // inherited: {{isInherited}} + super.{{name}}({{name}}); + return this; + } + {{#vendorExtensions.x-is-jackson-optional-nullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{name}} = {{name}}; + return this; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/parentVars}} + + /** + * returns a built {{classname}} instance. + * + * The builder is not reusable. + */ + public {{classname}} build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused{{#parentModel}} + super.build();{{/parentModel}} + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static {{classname}}.Builder builder() { + return new {{classname}}.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public {{classname}}.Builder toBuilder() { + return new {{classname}}.Builder(){{#allVars}} + .{{name}}({{getter}}()){{/allVars}}; + } 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/Java/libraries/native/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache index c440057eb76e..15bd2f96d244 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache @@ -593,4 +593,8 @@ static { JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); } {{/discriminator}} +{{#generateBuilders}} + + {{>javaBuilder}} +{{/generateBuilders}} } diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index 8cee0ac5a565..d4c6ec8d1540 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -629,5 +629,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } }; {{/parcelableModel}} +{{#generateBuilders}} + + {{>javaBuilder}} +{{/generateBuilders}} } 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/JavaSpring/javaBuilder.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/javaBuilder.mustache new file mode 100644 index 000000000000..9f369e65cfca --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/javaBuilder.mustache @@ -0,0 +1,96 @@ + + public static class Builder {{#parentModel}}extends {{classname}}.Builder {{/parentModel}}{ + + private {{classname}} instance; + + public Builder() { + this(new {{classname}}()); + } + + protected Builder({{classname}} instance) { + {{#parentModel}} + super(instance); // the parent builder shares the same instance + {{/parentModel}} + this.instance = instance; + } + + protected Builder copyOf({{classname}} value) { {{#parentModel}} + super.copyOf(instance);{{/parentModel}}{{#vars}} + this.instance.{{setter}}(value.{{name}});{{/vars}} + return this; + } + +{{#vars}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.instance.{{name}}({{name}}); + return this; + } + {{#deprecated}} + @Deprecated + {{/deprecated}} + {{#openApiNullable}}{{#isNullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{name}} = {{name}}; + return this; + } + {{/isNullable}}{{/openApiNullable}} +{{/vars}} +{{#parentVars}} + @Override + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.instance.{{name}}({{name}}); + return this; + } + {{#openApiNullable}}{{#isNullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{setter}}({{name}}); + return this; + } + {{/isNullable}}{{/openApiNullable}} +{{/parentVars}} +{{#additionalPropertiesType}} + public {{classname}}.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + +{{/additionalPropertiesType}} + /** + * returns a built {{classname}} instance. + * + * The builder is not reusable (NullPointerException) + */ + public {{classname}} build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused{{#parentModel}} + super.build();{{/parentModel}} + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static {{classname}}.Builder builder() { + return new {{classname}}.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public {{classname}}.Builder toBuilder() { + {{! using the instance setter ensure compatibility with Optional and JsonNullable}} + {{classname}}.Builder builder = new {{classname}}.Builder(); + return builder.copyOf(this); + } diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index db03e875533a..fd4052fa7c2e 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -93,17 +93,17 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} {{/openApiNullable}} {{/isContainer}} {{/vars}} - {{^lombok.Data}} - {{^lombok.RequiredArgsConstructor}} - {{#generatedConstructorWithRequiredArgs}} - {{#hasRequired}} + {{#vendorExtensions.x-java-no-args-constructor}} - {{^lombok.NoArgsConstructor}} public {{classname}}() { super(); } + {{/vendorExtensions.x-java-no-args-constructor}} + {{^lombok.Data}} + {{^lombok.RequiredArgsConstructor}} + {{#generatedConstructorWithRequiredArgs}} + {{#hasRequired}} - {{/lombok.NoArgsConstructor}} /** * Constructor with only required parameters{{#generateConstructorWithAllArgs}}{{^vendorExtensions.x-java-all-args-constructor}} and all parameters{{/vendorExtensions.x-java-all-args-constructor}}{{/generateConstructorWithAllArgs}} */ @@ -114,7 +114,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} {{#vars}} {{#required}} {{#openApiNullable}} - this.{{name}} = {{#isNullable}}JsonNullable.of({{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}Optional.ofNullable({{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}{{name}}{{#isNullable}}){{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}){{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}; + this.{{name}} = {{#isNullable}}JsonNullable.of({{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}Optional.of({{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}{{name}}{{#isNullable}}){{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}){{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}; {{/openApiNullable}} {{^openApiNullable}} this.{{name}} = {{name}}; @@ -136,7 +136,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} {{/parent}} {{#vars}} {{#openApiNullable}} - this.{{name}} = {{#isNullable}}JsonNullable.of({{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}Optional.ofNullable({{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}{{name}}{{#isNullable}}){{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}){{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}; + this.{{name}} = {{#isNullable}}JsonNullable.of({{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}Optional.of({{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}{{name}}{{#isNullable}}){{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}){{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}; {{/openApiNullable}} {{^openApiNullable}} this.{{name}} = {{name}}; @@ -351,5 +351,8 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} return o.toString().replace("\n", "\n "); } {{/lombok.ToString}} + {{#generateBuilders}} + {{>javaBuilder}} + {{/generateBuilders}} {{/lombok.Data}} } 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 8ef2ae4d61e8..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,39 +4910,28 @@ 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 public void testAllVars_issue_18340() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/spring/issue_18340.yaml"); - new OpenAPINormalizer(openAPI, Map.of("REFACTOR_ALLOF_WITH_PROPERTIES_ONLY", " true")) + new OpenAPINormalizer(openAPI, Map.of("REFACTOR_ALLOF_WITH_PROPERTIES_ONLY", "true")) .normalize(); Schema catModel = ModelUtils.getSchema(openAPI, "Cat"); Schema cat2Model = ModelUtils.getSchema(openAPI, "Cat2"); DefaultCodegen defaultCodegen = new DefaultCodegen(); defaultCodegen.setOpenAPI(openAPI); CodegenModel defaultCat = defaultCodegen.fromModel("Cat", catModel); - assertThat(getNames(defaultCat.allVars)).isEqualTo(List.of("name", "petType")); + assertThat(getNames(defaultCat.allVars)).isEqualTo(List.of("petType", "name")); - // same model gives an invalid var when using SpringCodegen. name is missing + // the normalizer makes it work even for generators supporting inheritance SpringCodegen springCodegen = new SpringCodegen(); springCodegen.setOpenAPI(openAPI); CodegenModel springCat = springCodegen.fromModel("Cat", catModel); - assertThat(getNames(springCat.allVars)).isEqualTo(List.of("petType")); // should be name,petType + assertThat(getNames(springCat.allVars)).isEqualTo(List.of("petType", "name")); CodegenModel springCat2 = springCodegen.fromModel("Cat2", cat2Model); assertThat(getNames(springCat2.allVars)).isEqualTo(List.of("petType", "name")); - - // Prove that supportsInheritance is the culprit - SpringCodegen springCodegenNoSupportInheritance = new SpringCodegen() { - { - this.supportsInheritance = false; - } - }; - springCodegenNoSupportInheritance.setOpenAPI(openAPI); - CodegenModel springCatNoSupportInheritance = springCodegenNoSupportInheritance.fromModel("Cat", catModel); - assertThat(getNames(springCatNoSupportInheritance.allVars)).isEqualTo(List.of("name", "petType")); } - } 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 5d10b33e2c6d..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,7 +17,7 @@ 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; @@ -109,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"); @@ -123,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"); @@ -142,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 @@ -153,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 @@ -177,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 @@ -185,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 @@ -213,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 @@ -244,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 @@ -321,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 @@ -333,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"); } @@ -355,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"); } @@ -377,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 @@ -390,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 @@ -410,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 @@ -435,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"); @@ -511,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"); @@ -599,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( @@ -668,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"), @@ -695,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"); @@ -722,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 @@ -791,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); } @@ -820,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); } @@ -899,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"); } /** @@ -949,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(); @@ -964,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"); @@ -979,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 @@ -993,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() { @@ -1049,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); } /** @@ -1329,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( @@ -1624,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( @@ -1655,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( @@ -2126,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( @@ -2464,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 @@ -2997,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( @@ -3121,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); } 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/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/java/builder.yaml b/modules/openapi-generator/src/test/resources/3_0/java/builder.yaml new file mode 100644 index 000000000000..bf77f24a4001 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/java/builder.yaml @@ -0,0 +1,140 @@ +openapi: 3.0.2 +info: + title: OAI Specification example for Polymorphism + version: 1.0.0 +paths: + /pet: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + /reptile: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/Reptile' + /mypets: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/MyPets' +components: + schemas: + SimpleObject: + type: object + properties: + nb: + type: number + minimum: 1 + simple: + type: string + list: + type: array + items: + minLength: 1 + type: string + nullableObject: + type: string + nullable: true + nullableList: + type: array + nullable: true + items: + maxLength: 100 + type: string + additionalProperties: + type: integer + Pet: + type: object + required: + - petType + properties: + petType: + type: string + name: + type: string + petReadonlyProperty: + type: string + readOnly: true + petNullableProperty: + type: string + nullable: true + discriminator: + propertyName: petType + additionalProperties: + type: number + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + name: + type: string + Reptile: + allOf: + - $ref: '#/components/schemas/Pet' + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + bark: + type: string + simple: + $ref: '#/components/schemas/SimpleObject' + Lizard: + allOf: + - $ref: '#/components/schemas/Reptile' + - type: object + properties: + lovesRocks: + type: boolean + readOnly: true + Snake: + allOf: + - $ref: '#/components/schemas/Reptile' + - type: object + properties: + hasLegs: + type: boolean + MyPets: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Lizard' + discriminator: + propertyName: petType + # per https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminatorObject + # this discriminator must be included to use it as a hint to pick a schema + MyPetsNoDisc: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Lizard' + A: + type: object + required: + - petType + properties: + petType: + type: string + discriminator: + propertyName: petType + mapping: + b: '#/components/schemas/B' + B: + allOf: + - $ref: '#/components/schemas/A' + C: + allOf: + - $ref: '#/components/schemas/B' 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/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) = + private fun WebClient.RequestBodyUriSpec.uri(requestConfig: RequestConfig) = uri { builder -> builder .path(requestConfig.path) @@ -43,11 +44,11 @@ open class ApiClient(protected val client: RestClient) { .build(requestConfig.params) } - private fun RestClient.RequestBodySpec.headers(requestConfig: RequestConfig) = + private fun WebClient.RequestBodySpec.headers(requestConfig: RequestConfig) = apply { requestConfig.headers.forEach { (name, value) -> header(name, value) } } - private fun RestClient.RequestBodySpec.nullableBody(requestConfig: RequestConfig) = - apply { if (requestConfig.body != null) body(requestConfig.body) } + private fun WebClient.RequestBodySpec.body(requestConfig: RequestConfig) = + apply { if (requestConfig.body != null) bodyValue(requestConfig.body) } } inline fun parseDateToQueryString(value : T): String { diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/build.gradle b/samples/client/echo_api/kotlin-model-prefix-type-mappings/build.gradle index 9c88de984d95..327c406db3c0 100644 --- a/samples/client/echo_api/kotlin-model-prefix-type-mappings/build.gradle +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/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.kotlin_version = '1.9.23' ext.retrofitVersion = '2.10.0' - // 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" } diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.jar b/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.jar and b/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.properties b/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/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-model-prefix-type-mappings/gradlew b/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradlew +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/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-model-prefix-type-mappings/gradlew.bat b/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/echo_api/kotlin-model-prefix-type-mappings/gradlew.bat +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/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-model-prefix-type-mappings/settings.gradle b/samples/client/echo_api/kotlin-model-prefix-type-mappings/settings.gradle index 4b38a2a52a34..e9557672dc88 100644 --- a/samples/client/echo_api/kotlin-model-prefix-type-mappings/settings.gradle +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-client-prefix-mapping' diff --git a/samples/client/echo_api/typescript-axios/build/api.ts b/samples/client/echo_api/typescript-axios/build/api.ts index 384ba1cdfc3c..f22a7e72ccaf 100644 --- a/samples/client/echo_api/typescript-axios/build/api.ts +++ b/samples/client/echo_api/typescript-axios/build/api.ts @@ -615,7 +615,7 @@ export const BodyApiAxiosParamCreator = function (configuration?: Configuration) if (files) { files.forEach((element) => { - localVarFormParams.append('files', element as any); + localVarFormParams.append('files', element as any); }) } diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/build.gradle b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/build.gradle +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradle/wrapper/gradle-wrapper.jar b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradle/wrapper/gradle-wrapper.jar and b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradle/wrapper/gradle-wrapper.properties b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/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/others/kotlin-jvm-okhttp-parameter-tests/gradlew b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradlew +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/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/others/kotlin-jvm-okhttp-parameter-tests/gradlew.bat b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/gradlew.bat +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/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/others/kotlin-jvm-okhttp-parameter-tests/settings.gradle b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/settings.gradle index 0e6aed9e795b..e7cb048a41e8 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/settings.gradle +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-okhttp4-parameter-tests' diff --git a/samples/client/others/rust/Cargo.toml b/samples/client/others/rust/Cargo.toml index 85fad3af177b..d36e0a12fecd 100644 --- a/samples/client/others/rust/Cargo.toml +++ b/samples/client/others/rust/Cargo.toml @@ -1,2 +1,3 @@ [workspace] members = ["hyper/*", "reqwest/*", "reqwest-regression-16119"] +resolver = "2" diff --git a/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml b/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml index 78dd6778b998..bbf7d006f499 100644 --- a/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml +++ b/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } 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 = { version = "~0.14", features = ["full"] } hyper-tls = "~0.5" http = "~0.2" diff --git a/samples/client/others/rust/hyper/api-with-ref-param/src/apis/mod.rs b/samples/client/others/rust/hyper/api-with-ref-param/src/apis/mod.rs index 1a5b2f58e4b9..4d85ccfc475d 100644 --- a/samples/client/others/rust/hyper/api-with-ref-param/src/apis/mod.rs +++ b/samples/client/others/rust/hyper/api-with-ref-param/src/apis/mod.rs @@ -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/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs b/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs index b49043ca0402..1de74d07cff1 100644 --- a/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs +++ b/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs @@ -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/samples/client/others/rust/hyper/api-with-ref-param/src/models/color.rs b/samples/client/others/rust/hyper/api-with-ref-param/src/models/color.rs index b5df438c6522..26b274a562ee 100644 --- a/samples/client/others/rust/hyper/api-with-ref-param/src/models/color.rs +++ b/samples/client/others/rust/hyper/api-with-ref-param/src/models/color.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/samples/client/others/rust/hyper/composed-oneof/Cargo.toml b/samples/client/others/rust/hyper/composed-oneof/Cargo.toml index 0f8feed80f4b..c91777db137c 100644 --- a/samples/client/others/rust/hyper/composed-oneof/Cargo.toml +++ b/samples/client/others/rust/hyper/composed-oneof/Cargo.toml @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } 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 = { version = "~0.14", features = ["full"] } hyper-tls = "~0.5" http = "~0.2" diff --git a/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs b/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs index 1a5b2f58e4b9..4d85ccfc475d 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs @@ -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/samples/client/others/rust/hyper/composed-oneof/src/lib.rs b/samples/client/others/rust/hyper/composed-oneof/src/lib.rs index b49043ca0402..1de74d07cff1 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/lib.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/lib.rs @@ -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/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs index a3ba90fcdede..7e3701b8c963 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "realtype")] diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs index afff7fb23a6b..2b3c27f0d4e8 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "realtype")] diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs index 1b1f60a3ffd7..c4f53db183da 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "realtype")] diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs index aaa86cbafbb0..aeee0c377e42 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "realtype")] diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs index 67e72b00fed4..0d581be15d95 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ObjA { diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs index 835695c76619..d0c508338d86 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ObjB { diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs index abc6aae24870..df21df238a32 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ObjC { diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs index 287c2f24e3e9..37640c7b418c 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ObjD { diff --git a/samples/client/others/rust/hyper/emptyObject/Cargo.toml b/samples/client/others/rust/hyper/emptyObject/Cargo.toml index 3574a9d4a89f..7e570fe7056f 100644 --- a/samples/client/others/rust/hyper/emptyObject/Cargo.toml +++ b/samples/client/others/rust/hyper/emptyObject/Cargo.toml @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"] description = "Ensure rust supports empty objects using serde::Value" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } 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 = { version = "~0.14", features = ["full"] } hyper-tls = "~0.5" http = "~0.2" diff --git a/samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs b/samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs index 1a5b2f58e4b9..4d85ccfc475d 100644 --- a/samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs +++ b/samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs @@ -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/samples/client/others/rust/hyper/emptyObject/src/lib.rs b/samples/client/others/rust/hyper/emptyObject/src/lib.rs index b49043ca0402..1de74d07cff1 100644 --- a/samples/client/others/rust/hyper/emptyObject/src/lib.rs +++ b/samples/client/others/rust/hyper/emptyObject/src/lib.rs @@ -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/samples/client/others/rust/hyper/emptyObject/src/models/empty_object.rs b/samples/client/others/rust/hyper/emptyObject/src/models/empty_object.rs index 6db5fbff7ad2..ed5bffc2d379 100644 --- a/samples/client/others/rust/hyper/emptyObject/src/models/empty_object.rs +++ b/samples/client/others/rust/hyper/emptyObject/src/models/empty_object.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EmptyObject { diff --git a/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml b/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml index 9b6c6d0bed38..7e1c7960f6dd 100644 --- a/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml +++ b/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } 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 = { version = "~0.14", features = ["full"] } hyper-tls = "~0.5" http = "~0.2" diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/apis/mod.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/apis/mod.rs index 1a5b2f58e4b9..4d85ccfc475d 100644 --- a/samples/client/others/rust/hyper/oneOf-array-map/src/apis/mod.rs +++ b/samples/client/others/rust/hyper/oneOf-array-map/src/apis/mod.rs @@ -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/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs index b49043ca0402..1de74d07cff1 100644 --- a/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs +++ b/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs @@ -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/samples/client/others/rust/hyper/oneOf-array-map/src/models/apple.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/models/apple.rs index 8472b2a8e5a0..a9f47c5e029b 100644 --- a/samples/client/others/rust/hyper/oneOf-array-map/src/models/apple.rs +++ b/samples/client/others/rust/hyper/oneOf-array-map/src/models/apple.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Apple { diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/models/fruit.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/models/fruit.rs index 3bf995add30f..827f9e470638 100644 --- a/samples/client/others/rust/hyper/oneOf-array-map/src/models/fruit.rs +++ b/samples/client/others/rust/hyper/oneOf-array-map/src/models/fruit.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/models/grape.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/models/grape.rs index bc7d12681c4e..50b1144cd1de 100644 --- a/samples/client/others/rust/hyper/oneOf-array-map/src/models/grape.rs +++ b/samples/client/others/rust/hyper/oneOf-array-map/src/models/grape.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Grape { diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml b/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml index 60cde076e1bf..6ff45ef734e9 100644 --- a/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml +++ b/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml @@ -4,14 +4,13 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" license = "MIT" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } 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 = { version = "~0.14", features = ["full"] } hyper-tls = "~0.5" http = "~0.2" diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/apis/mod.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/apis/mod.rs index 1a5b2f58e4b9..4d85ccfc475d 100644 --- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/apis/mod.rs +++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/apis/mod.rs @@ -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/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs index b49043ca0402..1de74d07cff1 100644 --- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs +++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs @@ -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/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/apple.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/apple.rs index 72586e604716..6a7c03c3bc1e 100644 --- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/apple.rs +++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/apple.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Apple { diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/banana.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/banana.rs index b3dfb65a245d..a80f3d23e0fe 100644 --- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/banana.rs +++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/banana.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Banana { diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/fruit.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/fruit.rs index e1b018e84114..cd28f15520c0 100644 --- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/fruit.rs +++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/fruit.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "fruitType")] diff --git a/samples/client/others/rust/hyper/oneOf/Cargo.toml b/samples/client/others/rust/hyper/oneOf/Cargo.toml index 0209137ee82e..647e27693941 100644 --- a/samples/client/others/rust/hyper/oneOf/Cargo.toml +++ b/samples/client/others/rust/hyper/oneOf/Cargo.toml @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"] description = "This tests for a oneOf interface representation " # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } 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 = { version = "~0.14", features = ["full"] } hyper-tls = "~0.5" http = "~0.2" diff --git a/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs b/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs index e0dbe42efe7c..288eec40a0e0 100644 --- a/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs +++ b/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs @@ -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/samples/client/others/rust/hyper/oneOf/src/lib.rs b/samples/client/others/rust/hyper/oneOf/src/lib.rs index b49043ca0402..1de74d07cff1 100644 --- a/samples/client/others/rust/hyper/oneOf/src/lib.rs +++ b/samples/client/others/rust/hyper/oneOf/src/lib.rs @@ -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/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs b/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs index 82d62ccc2883..bbca8e7e9236 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Addressable : Base schema for addressable entities #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/others/rust/hyper/oneOf/src/models/apple.rs b/samples/client/others/rust/hyper/oneOf/src/models/apple.rs index 54b954846718..3796fb213f47 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/apple.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/apple.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Apple { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/banana.rs b/samples/client/others/rust/hyper/oneOf/src/models/banana.rs index d026dbd2b8e5..4bfe41822573 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/banana.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/banana.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Banana { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar.rs index 7508b00b9af5..2499fb3a586b 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/bar.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/bar.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Bar { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs index 0afc67998fe4..6eb81b990336 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct BarCreate { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs index 42e2176fca0b..8533dd933f57 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct BarRef { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs index 3c9312706a76..6d1977d5ba0e 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] diff --git a/samples/client/others/rust/hyper/oneOf/src/models/entity.rs b/samples/client/others/rust/hyper/oneOf/src/models/entity.rs index b864cab686e0..bfb1aac3382c 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/entity.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/entity.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "@type")] diff --git a/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs index 60773f6e9afb..01272ef9fadb 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// EntityRef : Entity reference schema to be use for all entityRef class. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs b/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs index d87abf5be19a..23875ef0c6e2 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Extensible { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo.rs index be82765a3a89..ea618695d0bd 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/foo.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/foo.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Foo { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs index 11640d85a7ca..d0b425044b75 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FooRef { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs index b3ad0848d623..fbbbd13150e3 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "@type")] diff --git a/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs b/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs index 84967523295e..56d7f1eba285 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "fruitType")] diff --git a/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs b/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs index 00f405a7846a..e24e1de32119 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs b/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs index 69ae5110cf6d..8ba2efce0838 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pasta { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs b/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs index 6ae7f457df41..bfe6de648264 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pizza { diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs b/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs index e1c5258c616d..a294e07dfdbf 100644 --- a/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs +++ b/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PizzaSpeziale { diff --git a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml index 529ee9eba634..1919da46b088 100644 --- a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml +++ b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml @@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs b/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs index 9f70938d1bc3..3886a83c9543 100644 --- a/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/others/rust/reqwest-regression-16119/src/lib.rs b/samples/client/others/rust/reqwest-regression-16119/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/others/rust/reqwest-regression-16119/src/lib.rs +++ b/samples/client/others/rust/reqwest-regression-16119/src/lib.rs @@ -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/samples/client/others/rust/reqwest-regression-16119/src/models/parent.rs b/samples/client/others/rust/reqwest-regression-16119/src/models/parent.rs index 620ea7cb4b94..31d1ea44857c 100644 --- a/samples/client/others/rust/reqwest-regression-16119/src/models/parent.rs +++ b/samples/client/others/rust/reqwest-regression-16119/src/models/parent.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Parent { diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml b/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml index 7aacac5ecacf..7fc367e02dd3 100644 --- a/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml +++ b/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml @@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "multipart"] } diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs b/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs index b1be5415e4d8..27a37acccf49 100644 --- a/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs b/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs +++ b/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs @@ -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/samples/client/others/rust/reqwest/api-with-ref-param/src/models/color.rs b/samples/client/others/rust/reqwest/api-with-ref-param/src/models/color.rs index b5df438c6522..26b274a562ee 100644 --- a/samples/client/others/rust/reqwest/api-with-ref-param/src/models/color.rs +++ b/samples/client/others/rust/reqwest/api-with-ref-param/src/models/color.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml index 0ff96294b5ab..0a06ebb4f872 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml +++ b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml @@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs b/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs index 03e6c12b1715..59d4035053a9 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs b/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs @@ -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/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs index a3ba90fcdede..7e3701b8c963 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "realtype")] diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs index afff7fb23a6b..2b3c27f0d4e8 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "realtype")] diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs index 1b1f60a3ffd7..c4f53db183da 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "realtype")] diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs index aaa86cbafbb0..aeee0c377e42 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "realtype")] diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs index 67e72b00fed4..0d581be15d95 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ObjA { diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs index 835695c76619..d0c508338d86 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ObjB { diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs index abc6aae24870..df21df238a32 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ObjC { diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs index 287c2f24e3e9..37640c7b418c 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ObjD { diff --git a/samples/client/others/rust/reqwest/emptyObject/Cargo.toml b/samples/client/others/rust/reqwest/emptyObject/Cargo.toml index fa318861c579..8245af0063cd 100644 --- a/samples/client/others/rust/reqwest/emptyObject/Cargo.toml +++ b/samples/client/others/rust/reqwest/emptyObject/Cargo.toml @@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"] description = "Ensure rust supports empty objects using serde::Value" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs b/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs index 09832aa9133e..5f5b46edc2c8 100644 --- a/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/others/rust/reqwest/emptyObject/src/lib.rs b/samples/client/others/rust/reqwest/emptyObject/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/others/rust/reqwest/emptyObject/src/lib.rs +++ b/samples/client/others/rust/reqwest/emptyObject/src/lib.rs @@ -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/samples/client/others/rust/reqwest/emptyObject/src/models/empty_object.rs b/samples/client/others/rust/reqwest/emptyObject/src/models/empty_object.rs index 6db5fbff7ad2..ed5bffc2d379 100644 --- a/samples/client/others/rust/reqwest/emptyObject/src/models/empty_object.rs +++ b/samples/client/others/rust/reqwest/emptyObject/src/models/empty_object.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EmptyObject { diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml b/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml index 9d5cdb680318..0b23d93ace1b 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml @@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs index b87854cd090c..c487220374ea 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs +++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs @@ -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/samples/client/others/rust/reqwest/oneOf-array-map/src/models/apple.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/apple.rs index 8472b2a8e5a0..a9f47c5e029b 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/apple.rs +++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/apple.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Apple { diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/fruit.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/fruit.rs index 3bf995add30f..827f9e470638 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/fruit.rs +++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/fruit.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/grape.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/grape.rs index bc7d12681c4e..50b1144cd1de 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/grape.rs +++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/grape.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Grape { diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml b/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml index 4c98b3374252..4d69b38b2e59 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml @@ -4,14 +4,11 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" license = "MIT" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs index c0d92bc1e7eb..035872574bf6 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs @@ -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/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/apple.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/apple.rs index 72586e604716..6a7c03c3bc1e 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/apple.rs +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/apple.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Apple { diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/banana.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/banana.rs index b3dfb65a245d..a80f3d23e0fe 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/banana.rs +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/banana.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Banana { diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/fruit.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/fruit.rs index e1b018e84114..cd28f15520c0 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/fruit.rs +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/fruit.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "fruitType")] diff --git a/samples/client/others/rust/reqwest/oneOf/Cargo.toml b/samples/client/others/rust/reqwest/oneOf/Cargo.toml index 91e5d81c55b2..89997ba95666 100644 --- a/samples/client/others/rust/reqwest/oneOf/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf/Cargo.toml @@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"] description = "This tests for a oneOf interface representation " # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs index 2d07cacdb490..f8ce13d5cac6 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs index be07fec20089..202e6bb66793 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/others/rust/reqwest/oneOf/src/lib.rs b/samples/client/others/rust/reqwest/oneOf/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/lib.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/lib.rs @@ -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/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs b/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs index 82d62ccc2883..bbca8e7e9236 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Addressable : Base schema for addressable entities #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs b/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs index 54b954846718..3796fb213f47 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Apple { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs b/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs index d026dbd2b8e5..4bfe41822573 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Banana { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs index 7508b00b9af5..2499fb3a586b 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Bar { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs index 0afc67998fe4..6eb81b990336 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct BarCreate { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs index 42e2176fca0b..8533dd933f57 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct BarRef { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs index 3c9312706a76..6d1977d5ba0e 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs b/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs index b864cab686e0..bfb1aac3382c 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "@type")] diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs index 60773f6e9afb..01272ef9fadb 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// EntityRef : Entity reference schema to be use for all entityRef class. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs b/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs index d87abf5be19a..23875ef0c6e2 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Extensible { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs index be82765a3a89..ea618695d0bd 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Foo { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs index 11640d85a7ca..d0b425044b75 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FooRef { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs index b3ad0848d623..fbbbd13150e3 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "@type")] diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs b/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs index 84967523295e..56d7f1eba285 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "fruitType")] diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs b/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs index 00f405a7846a..e24e1de32119 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs index 69ae5110cf6d..8ba2efce0838 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pasta { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs index 6ae7f457df41..bfe6de648264 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pizza { diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs index e1c5258c616d..a294e07dfdbf 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PizzaSpeziale { diff --git a/samples/client/petstore/c/docs/another_model.md b/samples/client/petstore/c/docs/another_model.md new file mode 100644 index 000000000000..98d906f97a3d --- /dev/null +++ b/samples/client/petstore/c/docs/another_model.md @@ -0,0 +1,11 @@ +# another_model_t + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**another_property** | **int** | | [optional] +**uuid_property** | **char \*** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/c/model/another_model.c b/samples/client/petstore/c/model/another_model.c new file mode 100644 index 000000000000..11937d83fc45 --- /dev/null +++ b/samples/client/petstore/c/model/another_model.c @@ -0,0 +1,93 @@ +#include +#include +#include +#include "another_model.h" + + + +another_model_t *another_model_create( + int another_property, + char *uuid_property + ) { + another_model_t *another_model_local_var = malloc(sizeof(another_model_t)); + if (!another_model_local_var) { + return NULL; + } + another_model_local_var->another_property = another_property; + another_model_local_var->uuid_property = uuid_property; + + return another_model_local_var; +} + + +void another_model_free(another_model_t *another_model) { + if(NULL == another_model){ + return ; + } + listEntry_t *listEntry; + if (another_model->uuid_property) { + free(another_model->uuid_property); + another_model->uuid_property = NULL; + } + free(another_model); +} + +cJSON *another_model_convertToJSON(another_model_t *another_model) { + cJSON *item = cJSON_CreateObject(); + + // another_model->another_property + if(another_model->another_property) { + if(cJSON_AddNumberToObject(item, "another_property", another_model->another_property) == NULL) { + goto fail; //Numeric + } + } + + + // another_model->uuid_property + if(another_model->uuid_property) { + if(cJSON_AddStringToObject(item, "uuid_property", another_model->uuid_property) == NULL) { + goto fail; //String + } + } + + return item; +fail: + if (item) { + cJSON_Delete(item); + } + return NULL; +} + +another_model_t *another_model_parseFromJSON(cJSON *another_modelJSON){ + + another_model_t *another_model_local_var = NULL; + + // another_model->another_property + cJSON *another_property = cJSON_GetObjectItemCaseSensitive(another_modelJSON, "another_property"); + if (another_property) { + if(!cJSON_IsNumber(another_property)) + { + goto end; //Numeric + } + } + + // another_model->uuid_property + cJSON *uuid_property = cJSON_GetObjectItemCaseSensitive(another_modelJSON, "uuid_property"); + if (uuid_property) { + if(!cJSON_IsString(uuid_property) && !cJSON_IsNull(uuid_property)) + { + goto end; //String + } + } + + + another_model_local_var = another_model_create ( + another_property ? another_property->valuedouble : 0, + uuid_property && !cJSON_IsNull(uuid_property) ? strdup(uuid_property->valuestring) : NULL + ); + + return another_model_local_var; +end: + return NULL; + +} diff --git a/samples/client/petstore/c/model/another_model.h b/samples/client/petstore/c/model/another_model.h new file mode 100644 index 000000000000..0fe255704470 --- /dev/null +++ b/samples/client/petstore/c/model/another_model.h @@ -0,0 +1,39 @@ +/* + * another_model.h + * + * to test mapping features + */ + +#ifndef _another_model_H_ +#define _another_model_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +typedef struct another_model_t another_model_t; + + + + +typedef struct another_model_t { + int another_property; //numeric + char *uuid_property; // string + +} another_model_t; + +another_model_t *another_model_create( + int another_property, + char *uuid_property +); + +void another_model_free(another_model_t *another_model); + +another_model_t *another_model_parseFromJSON(cJSON *another_modelJSON); + +cJSON *another_model_convertToJSON(another_model_t *another_model); + +#endif /* _another_model_H_ */ + diff --git a/samples/client/petstore/c/unit-test/test_another_model.c b/samples/client/petstore/c/unit-test/test_another_model.c new file mode 100644 index 000000000000..9dddc1f3a2ae --- /dev/null +++ b/samples/client/petstore/c/unit-test/test_another_model.c @@ -0,0 +1,60 @@ +#ifndef another_model_TEST +#define another_model_TEST + +// the following is to include only the main from the first c file +#ifndef TEST_MAIN +#define TEST_MAIN +#define another_model_MAIN +#endif // TEST_MAIN + +#include +#include +#include +#include +#include "../external/cJSON.h" + +#include "../model/another_model.h" +another_model_t* instantiate_another_model(int include_optional); + + + +another_model_t* instantiate_another_model(int include_optional) { + another_model_t* another_model = NULL; + if (include_optional) { + another_model = another_model_create( + 56, + "0" + ); + } else { + another_model = another_model_create( + 56, + "0" + ); + } + + return another_model; +} + + +#ifdef another_model_MAIN + +void test_another_model(int include_optional) { + another_model_t* another_model_1 = instantiate_another_model(include_optional); + + cJSON* jsonanother_model_1 = another_model_convertToJSON(another_model_1); + printf("another_model :\n%s\n", cJSON_Print(jsonanother_model_1)); + another_model_t* another_model_2 = another_model_parseFromJSON(jsonanother_model_1); + cJSON* jsonanother_model_2 = another_model_convertToJSON(another_model_2); + printf("repeating another_model:\n%s\n", cJSON_Print(jsonanother_model_2)); +} + +int main() { + test_another_model(1); + test_another_model(0); + + printf("Hello world \n"); + return 0; +} + +#endif // another_model_MAIN +#endif // another_model_TEST diff --git a/samples/client/petstore/crystal/spec/models/property_name_mapping_spec.cr b/samples/client/petstore/crystal/spec/models/property_name_mapping_spec.cr new file mode 100644 index 000000000000..2c3f56c6368f --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/property_name_mapping_spec.cr @@ -0,0 +1,50 @@ +# #OpenAPI Petstore +# +##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#OpenAPI Generator version: 7.0.0-SNAPSHOT +# + +require "../spec_helper" +require "json" +require "time" + +# Unit tests for Petstore::PropertyNameMapping +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Petstore::PropertyNameMapping do + + describe "test an instance of PropertyNameMapping" do + it "should create an instance of PropertyNameMapping" do + #instance = Petstore::PropertyNameMapping.new + #expect(instance).to be_instance_of(Petstore::PropertyNameMapping) + end + end + describe "test attribute 'http_debug_operation'" do + it "should work" do + # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + end + end + + describe "test attribute '_type'" do + it "should work" do + # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + end + end + + describe "test attribute '_type'" do + it "should work" do + # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + end + end + + describe "test attribute 'type_'" do + it "should work" do + # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/property_name_mapping.cr b/samples/client/petstore/crystal/src/petstore/models/property_name_mapping.cr new file mode 100644 index 000000000000..e9d0661b1c5a --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/property_name_mapping.cr @@ -0,0 +1,193 @@ +# #OpenAPI Petstore +# +##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#OpenAPI Generator version: 7.0.0-SNAPSHOT +# + +require "big" +require "json" +require "time" + +module Petstore + class PropertyNameMapping + include JSON::Serializable + + # Optional properties + @[JSON::Field(key: "http_debug_operation", type: String?, nillable: true, emit_null: false)] + property http_debug_operation : String? + + @[JSON::Field(key: "_type", type: String?, nillable: true, emit_null: false)] + property _type : String? + + @[JSON::Field(key: "type", type: String?, nillable: true, emit_null: false)] + property _type : String? + + @[JSON::Field(key: "type_", type: String?, nillable: true, emit_null: false)] + property type_ : String? + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@http_debug_operation : String?, @_type : String?, @_type : String?, @type_ : String?) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.same?(o) + self.class == o.class && + http_debug_operation == o.http_debug_operation && + _type == o._type && + _type == o._type && + type_ == o.type_ + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [http_debug_operation, _type, _type, type_].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if !attributes[self.class.attribute_map[key]]? && self.class.openapi_nullable.includes?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + ({} of Symbol => String).tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Petstore.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} of Symbol => String + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.includes?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + ({} of Symbol => String).tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/deprecated_object.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/deprecated_object.ex new file mode 100644 index 000000000000..efbb7eacea89 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/deprecated_object.ex @@ -0,0 +1,22 @@ +# NOTE: This file is auto generated by OpenAPI Generator 7.0.0-SNAPSHOT (https://openapi-generator.tech). +# Do not edit this file manually. + +defmodule OpenapiPetstore.Model.DeprecatedObject do + @moduledoc """ + + """ + + @derive Jason.Encoder + defstruct [ + :name + ] + + @type t :: %__MODULE__{ + :name => String.t | nil + } + + def decode(value) do + value + end +end + diff --git a/samples/client/petstore/java/apache-httpclient/pom.xml b/samples/client/petstore/java/apache-httpclient/pom.xml index a619f987ac64..c522d5af58c2 100644 --- a/samples/client/petstore/java/apache-httpclient/pom.xml +++ b/samples/client/petstore/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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java index e6db7f775a5a..fa2ead534850 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -15,9 +15,9 @@ import org.openapitools.client.ApiException; import org.openapitools.client.model.Client; -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.util.ArrayList; import java.util.HashMap; @@ -27,7 +27,7 @@ /** * API tests for AnotherFakeApi */ -@Ignore +@Disabled public class AnotherFakeApiTest { private final AnotherFakeApi api = new AnotherFakeApi(); diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/DefaultApiTest.java index 32943c2bb918..a057e1c6ebb7 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/DefaultApiTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -15,9 +15,9 @@ import org.openapitools.client.ApiException; import org.openapitools.client.model.FooGetDefaultResponse; -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 DefaultApi */ -@Ignore +@Disabled public class DefaultApiTest { private final DefaultApi api = new DefaultApi(); diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/FakeApiTest.java index 5bdb09bab414..dbc0cceb6ebf 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -26,9 +26,9 @@ import org.openapitools.client.model.OuterObjectWithEnumProperty; import org.openapitools.client.model.Pet; import org.openapitools.client.model.User; -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; @@ -40,7 +40,7 @@ /** * API tests for FakeApi */ -@Ignore +@Disabled public class FakeApiTest { private final FakeApi api = new FakeApi(); diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java index 99d49a695dd3..125162d60cad 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -15,9 +15,9 @@ import org.openapitools.client.ApiException; import org.openapitools.client.model.Client; -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.util.ArrayList; import java.util.HashMap; @@ -27,7 +27,7 @@ /** * API tests for FakeClassnameTags123Api */ -@Ignore +@Disabled public class FakeClassnameTags123ApiTest { private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/PetApiTest.java index 6a8c50258e6f..50c24acbfad1 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -18,9 +18,9 @@ import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; import java.util.Set; -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.util.ArrayList; import java.util.HashMap; @@ -30,7 +30,7 @@ /** * API tests for PetApi */ -@Ignore +@Disabled public class PetApiTest { private final PetApi api = new PetApi(); diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/StoreApiTest.java index c7df74110dbc..5abd4f0bc887 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -15,9 +15,9 @@ import org.openapitools.client.ApiException; import org.openapitools.client.model.Order; -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.util.ArrayList; import java.util.HashMap; @@ -27,7 +27,7 @@ /** * API tests for StoreApi */ -@Ignore +@Disabled public class StoreApiTest { private final StoreApi api = new StoreApi(); diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/UserApiTest.java index cffd945d327f..325d33fcc691 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/UserApiTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -15,9 +15,9 @@ import org.openapitools.client.ApiException; import org.openapitools.client.model.User; -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.util.ArrayList; import java.util.HashMap; @@ -27,7 +27,7 @@ /** * API tests for UserApi */ -@Ignore +@Disabled public class UserApiTest { private final UserApi api = new UserApi(); diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java index 4f6fd800ab71..832d746f72d4 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java index 41e6497ecee9..d4426e578e49 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java @@ -21,9 +21,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java index d2e17831ba7c..9df6e6291a6a 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java index 14fd8022febe..11d4d7313ac2 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -22,9 +22,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java index 58b7521c6a7b..7fce2f458fff 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java index 10ad938f52cd..3d98032d55a7 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java @@ -21,9 +21,9 @@ import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java index bcbb9c54b27f..ad7d482159a3 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java index f7662d6c4692..e4bebcd23899 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AllOfWithSingleRefTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AllOfWithSingleRefTest.java index 1acef2d3969b..8c231167d612 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AllOfWithSingleRefTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AllOfWithSingleRefTest.java @@ -19,9 +19,9 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.SingleRefType; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AnimalTest.java index 930e5c17d074..2b04312bbebe 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AnimalTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -24,9 +24,9 @@ import org.openapitools.client.model.BigCat; import org.openapitools.client.model.Cat; import org.openapitools.client.model.Dog; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java index 57a1c4f37ec5..7d6ca2902ab5 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -21,9 +21,9 @@ import java.math.BigDecimal; 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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java index 4f127b838bc8..1db82cbdea33 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -21,9 +21,9 @@ import java.math.BigDecimal; 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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayTestTest.java index 5874400602c2..4a3a3cc839af 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayTestTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -21,9 +21,9 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.client.model.ReadOnlyFirst; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CapitalizationTest.java index c69ffc12a073..1f133e4142e4 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CapitalizationTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CapitalizationTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CatTest.java index 90fdba14c24b..50037f54841e 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CatTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CatTest.java @@ -23,9 +23,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; import org.openapitools.client.model.BigCat; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java index 393f73bd5e63..84df0f1e24da 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java +++ b/samples/client/petstore/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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ChildWithNullableTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ChildWithNullableTest.java index 2616181bec30..a109c6f71758 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ChildWithNullableTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ChildWithNullableTest.java @@ -23,9 +23,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.ParentWithNullable; import org.openapitools.jackson.nullable.JsonNullable; -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 ChildWithNullable diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ClassModelTest.java index 5005bcb800e6..0efd2b037523 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ClassModelTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ClassModelTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ClientTest.java index bda3b360b744..9fee039a47a4 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ClientTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ClientTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java index a61e43f63af0..06d586403935 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/DogTest.java index de77d6711bda..0f9f43fd3cac 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/DogTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/DogTest.java @@ -22,9 +22,9 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumArraysTest.java index 73206626b9c1..bd426ae14b51 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumArraysTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumArraysTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumClassTest.java index 9e45543facd2..19518a5f665b 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumClassTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumClassTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumTestTest.java index 8907cfa8e8f0..223a3d674bb2 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumTestTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -19,9 +19,9 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.OuterEnum; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java index 88c1d374be69..1792f6169d92 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -21,9 +21,9 @@ import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; -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 FakeBigDecimalMap200Response diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java index 493d84aa1bcf..53b20d7bdd31 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -21,9 +21,9 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.client.model.ModelFile; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java index 5830df74c8c1..85c3e9a29e77 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -19,9 +19,9 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Foo; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FooTest.java index 195e487a7981..b1825eb48eb9 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FooTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FooTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FormatTestTest.java index 48bec93d9943..ceaa76fef091 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FormatTestTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -23,9 +23,9 @@ import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.UUID; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java index da9073d45002..9a76d3c9534f 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java index 15cc82702c9d..d627568b70c9 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -22,9 +22,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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/MapTestTest.java index 22c8519472be..c85527e8536a 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/MapTestTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java index f29932e96bed..c5f70f4c8f0c 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -23,9 +23,9 @@ import java.util.Map; import java.util.UUID; import org.openapitools.client.model.Animal; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/Model200ResponseTest.java index 0cd3f9761989..0952e6472d04 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/Model200ResponseTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/Model200ResponseTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java index be8cca35e3e6..d57f86800479 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelApiResponseTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelFileTest.java index a0247ae71beb..4b2d71052119 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelFileTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelFileTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelListTest.java index 0ead99db3a5a..f39c6a118e39 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelListTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelListTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelReturnTest.java index b6ca02f8d239..a6968d2b87e8 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelReturnTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ModelReturnTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NameTest.java index 07684c9eb408..39ff782a3ea4 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NameTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NameTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NullableClassTest.java index cb3a631c913c..86e5a4e72498 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NullableClassTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NullableClassTest.java @@ -29,9 +29,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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberOnlyTest.java index 878095093ad5..88a5503ccf97 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberOnlyTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberOnlyTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java index c59d5beba3dc..72978f65097d 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java @@ -22,9 +22,9 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.client.model.DeprecatedObject; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OrderTest.java index f31e10a9df15..17f411d1ede9 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OrderTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OrderTest.java @@ -19,9 +19,9 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import java.time.OffsetDateTime; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterCompositeTest.java index 8b823572e5e1..11d7eeac3b75 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterCompositeTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterCompositeTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java index 59c4eebd2f0f..db6de4ebd34c 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java index fa981c709357..44b97d47c2eb 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java index 1b98d326bb13..908c8ce7e21a 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumTest.java index cf0ebae0faf0..f7293142020a 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterEnumTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterObjectWithEnumPropertyTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterObjectWithEnumPropertyTest.java index 1a436d40cb48..579a7f62fa76 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterObjectWithEnumPropertyTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/OuterObjectWithEnumPropertyTest.java @@ -19,9 +19,9 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.OuterEnumInteger; -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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ParentWithNullableTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ParentWithNullableTest.java index bdd46008b13d..828d360428ed 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ParentWithNullableTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ParentWithNullableTest.java @@ -25,9 +25,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; /** * Model tests for ParentWithNullable diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java index b48657d0c9ae..a10e870d0fdc 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java @@ -25,9 +25,9 @@ import java.util.Set; 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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java index 26356ec20487..11ab8eaf4fe1 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/SingleRefTypeTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/SingleRefTypeTest.java index 155e2a89b0b0..7db38f4f3382 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/SingleRefTypeTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/SingleRefTypeTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java index 4e59989875ac..c5d7ce076d6e 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/SpecialModelNameTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java index 5aeb2f3f948e..382a573036b9 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java +++ b/samples/client/petstore/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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java index 819a1e7fa9df..8e5a4ba75d27 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -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 TestInlineFreeformAdditionalPropertiesRequest diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java index 8c096c188fce..07eccf57ece7 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java @@ -21,9 +21,9 @@ import java.math.BigDecimal; 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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java index b1655df61656..3ce00657e258 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java @@ -21,9 +21,9 @@ import java.math.BigDecimal; 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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/UserTest.java index e0153a4cf1b9..eccfbf5e1263 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/UserTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/UserTest.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/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/XmlItemTest.java index 4bab95a91264..5dfb646e7f3f 100644 --- a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/XmlItemTest.java +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/XmlItemTest.java @@ -21,9 +21,9 @@ import java.math.BigDecimal; 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/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/README.md b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/README.md index e95301f74cda..4c3e40a34b5c 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/README.md +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/README.md @@ -1,4 +1,4 @@ -# OpenAPI Petstore - MicroProfile Rest Client +# OpenAPI Petstore - MicroProfile Rest Client & MicroProfile Server This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -6,3 +6,4 @@ This is a sample server Petstore server. For this sample, you can use the api ke 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. + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Category.java index 2d96b4ae1e43..1bedcba64e4e 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Category.java @@ -125,3 +125,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 5babfa9c7c73..ddfadbcf4100 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -158,3 +158,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Order.java index a0d60790f2ed..b4fd65862e2f 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Order.java @@ -293,3 +293,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Pet.java index 76f7cf9ad73c..cc6ecbaceecc 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Pet.java @@ -323,3 +323,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Tag.java index 8dbe24f53689..488983ce94f3 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/Tag.java @@ -125,3 +125,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/User.java index eb52b7e1339d..2e70b010de39 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/src/main/java/org/openapitools/client/model/User.java @@ -320,3 +320,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/README.md b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/README.md index e95301f74cda..4c3e40a34b5c 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/README.md +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/README.md @@ -1,4 +1,4 @@ -# OpenAPI Petstore - MicroProfile Rest Client +# OpenAPI Petstore - MicroProfile Rest Client & MicroProfile Server This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -6,3 +6,4 @@ This is a sample server Petstore server. For this sample, you can use the api ke 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. + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Category.java index aee5f670c011..f90df1d1bf3e 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Category.java @@ -112,3 +112,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java index d97eccb6651d..d66986b54787 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -143,3 +143,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Order.java index 980b9eb151f1..b6c0aec0c23d 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Order.java @@ -268,3 +268,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Pet.java index 79e2385dcf60..defd4504bc76 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Pet.java @@ -290,3 +290,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Tag.java index 9b3265fdd66c..283def00e3e8 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/Tag.java @@ -112,3 +112,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/User.java index 67af1789d141..26490077dd3e 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/model/User.java @@ -295,3 +295,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/README.md b/samples/client/petstore/java/microprofile-rest-client-3.0/README.md index e95301f74cda..4c3e40a34b5c 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/README.md +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/README.md @@ -1,4 +1,4 @@ -# OpenAPI Petstore - MicroProfile Rest Client +# OpenAPI Petstore - MicroProfile Rest Client & MicroProfile Server This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -6,3 +6,4 @@ This is a sample server Petstore server. For this sample, you can use the api ke 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. + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Category.java index f288f561181b..aa7007ad5d56 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Category.java @@ -101,3 +101,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/ModelApiResponse.java index b1a8ea4f25e5..44eea59b3eeb 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -125,3 +125,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Order.java index 6518f71fce6e..d378038fc30f 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Order.java @@ -243,3 +243,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Pet.java index 50d982f0be7f..822179523dc9 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Pet.java @@ -265,3 +265,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Tag.java index 09ed3b6f9750..fecc6943bff3 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/Tag.java @@ -101,3 +101,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/User.java index 9dce754424ba..e4f99ba38d39 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/model/User.java @@ -248,3 +248,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/README.md b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/README.md index e95301f74cda..4c3e40a34b5c 100644 --- a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/README.md +++ b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/README.md @@ -1,4 +1,4 @@ -# OpenAPI Petstore - MicroProfile Rest Client +# OpenAPI Petstore - MicroProfile Rest Client & MicroProfile Server This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -6,3 +6,4 @@ This is a sample server Petstore server. For this sample, you can use the api ke 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. + diff --git a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Category.java index f288f561181b..aa7007ad5d56 100644 --- a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Category.java @@ -101,3 +101,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java index b1a8ea4f25e5..44eea59b3eeb 100644 --- a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -125,3 +125,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Order.java index 6518f71fce6e..d378038fc30f 100644 --- a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Order.java @@ -243,3 +243,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Pet.java index 50d982f0be7f..822179523dc9 100644 --- a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Pet.java @@ -265,3 +265,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Tag.java index 09ed3b6f9750..fecc6943bff3 100644 --- a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Tag.java @@ -101,3 +101,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/User.java index 9dce754424ba..e4f99ba38d39 100644 --- a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/src/main/java/org/openapitools/client/model/User.java @@ -248,3 +248,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client/README.md b/samples/client/petstore/java/microprofile-rest-client/README.md index e95301f74cda..4c3e40a34b5c 100644 --- a/samples/client/petstore/java/microprofile-rest-client/README.md +++ b/samples/client/petstore/java/microprofile-rest-client/README.md @@ -1,4 +1,4 @@ -# OpenAPI Petstore - MicroProfile Rest Client +# OpenAPI Petstore - MicroProfile Rest Client & MicroProfile Server This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -6,3 +6,4 @@ This is a sample server Petstore server. For this sample, you can use the api ke 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. + diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md b/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md index fdc9c56bd004..fb5361b0808f 100644 --- a/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md +++ b/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md @@ -17,10 +17,12 @@ All URIs are relative to *http://petstore.swagger.io/v2* ## addPet -> void addPet(body) +> Pet addPet(pet) Add a new pet to the store + + ### Example ```java @@ -42,9 +44,9 @@ public class Example { petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(defaultClient); - Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - void result = apiInstance.addPet(body); + Pet result = apiInstance.addPet(pet); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PetApi#addPet"); @@ -62,11 +64,11 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | ### Return type -[**void**](Void.md) +[**Pet**](Pet.md) ### Authorization @@ -75,12 +77,13 @@ public class Example { ### HTTP request headers - **Content-Type**: application/json, application/xml -- **Accept**: Not defined +- **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +| **200** | successful operation | - | | **405** | Invalid input | - | @@ -90,6 +93,8 @@ public class Example { Deletes a pet + + ### Example ```java @@ -376,10 +381,12 @@ public class Example { ## updatePet -> void updatePet(body) +> Pet updatePet(pet) Update an existing pet + + ### Example ```java @@ -401,9 +408,9 @@ public class Example { petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(defaultClient); - Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - void result = apiInstance.updatePet(body); + Pet result = apiInstance.updatePet(pet); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PetApi#updatePet"); @@ -421,11 +428,11 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | ### Return type -[**void**](Void.md) +[**Pet**](Pet.md) ### Authorization @@ -434,12 +441,13 @@ public class Example { ### HTTP request headers - **Content-Type**: application/json, application/xml -- **Accept**: Not defined +- **Accept**: application/xml, application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +| **200** | successful operation | - | | **400** | Invalid ID supplied | - | | **404** | Pet not found | - | | **405** | Validation exception | - | @@ -451,6 +459,8 @@ public class Example { Updates a pet in the store with form data + + ### Example ```java @@ -524,6 +534,8 @@ public class Example { uploads an image + + ### Example ```java diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/StoreApi.md b/samples/client/petstore/java/microprofile-rest-client/docs/StoreApi.md index 4d90de84607a..ae64b8574e22 100644 --- a/samples/client/petstore/java/microprofile-rest-client/docs/StoreApi.md +++ b/samples/client/petstore/java/microprofile-rest-client/docs/StoreApi.md @@ -217,10 +217,12 @@ No authorization required ## placeOrder -> Order placeOrder(body) +> Order placeOrder(order) Place an order for a pet + + ### Example ```java @@ -237,9 +239,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io/v2"); StoreApi apiInstance = new StoreApi(defaultClient); - Order body = new Order(); // Order | order placed for purchasing the pet + Order order = new Order(); // Order | order placed for purchasing the pet try { - Order result = apiInstance.placeOrder(body); + Order result = apiInstance.placeOrder(order); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling StoreApi#placeOrder"); @@ -257,7 +259,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **body** | [**Order**](Order.md)| order placed for purchasing the pet | | +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | ### Return type @@ -269,7 +271,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/UserApi.md b/samples/client/petstore/java/microprofile-rest-client/docs/UserApi.md index babf04d19166..89c1bfc6026d 100644 --- a/samples/client/petstore/java/microprofile-rest-client/docs/UserApi.md +++ b/samples/client/petstore/java/microprofile-rest-client/docs/UserApi.md @@ -17,7 +17,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* ## createUser -> void createUser(body) +> void createUser(user) Create user @@ -30,6 +30,7 @@ This can only be done by the logged in user. import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.UserApi; @@ -37,11 +38,17 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); UserApi apiInstance = new UserApi(defaultClient); - User body = new User(); // User | Created user object + User user = new User(); // User | Created user object try { - void result = apiInstance.createUser(body); + void result = apiInstance.createUser(user); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUser"); @@ -59,7 +66,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **body** | [**User**](User.md)| Created user object | | +| **user** | [**User**](User.md)| Created user object | | ### Return type @@ -67,11 +74,11 @@ public class Example { ### Authorization -No authorization required +[api_key](../README.md#api_key) ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined @@ -83,10 +90,12 @@ No authorization required ## createUsersWithArrayInput -> void createUsersWithArrayInput(body) +> void createUsersWithArrayInput(user) Creates list of users with given input array + + ### Example ```java @@ -94,6 +103,7 @@ Creates list of users with given input array import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.UserApi; @@ -101,11 +111,17 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); UserApi apiInstance = new UserApi(defaultClient); - List body = Arrays.asList(); // List | List of user object + List user = Arrays.asList(); // List | List of user object try { - void result = apiInstance.createUsersWithArrayInput(body); + void result = apiInstance.createUsersWithArrayInput(user); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); @@ -123,7 +139,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **body** | [**List<User>**](User.md)| List of user object | | +| **user** | [**List<User>**](User.md)| List of user object | | ### Return type @@ -131,11 +147,11 @@ public class Example { ### Authorization -No authorization required +[api_key](../README.md#api_key) ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined @@ -147,10 +163,12 @@ No authorization required ## createUsersWithListInput -> void createUsersWithListInput(body) +> void createUsersWithListInput(user) Creates list of users with given input array + + ### Example ```java @@ -158,6 +176,7 @@ Creates list of users with given input array import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.UserApi; @@ -165,11 +184,17 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); UserApi apiInstance = new UserApi(defaultClient); - List body = Arrays.asList(); // List | List of user object + List user = Arrays.asList(); // List | List of user object try { - void result = apiInstance.createUsersWithListInput(body); + void result = apiInstance.createUsersWithListInput(user); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUsersWithListInput"); @@ -187,7 +212,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **body** | [**List<User>**](User.md)| List of user object | | +| **user** | [**List<User>**](User.md)| List of user object | | ### Return type @@ -195,11 +220,11 @@ public class Example { ### Authorization -No authorization required +[api_key](../README.md#api_key) ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined @@ -224,6 +249,7 @@ This can only be done by the logged in user. import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.UserApi; @@ -231,6 +257,12 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); UserApi apiInstance = new UserApi(defaultClient); String username = "username_example"; // String | The name that needs to be deleted @@ -261,7 +293,7 @@ public class Example { ### Authorization -No authorization required +[api_key](../README.md#api_key) ### HTTP request headers @@ -282,6 +314,8 @@ No authorization required Get user by user name + + ### Example ```java @@ -348,6 +382,8 @@ No authorization required Logs user into the system + + ### Example ```java @@ -405,7 +441,7 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| | **400** | Invalid username/password supplied | - | @@ -415,6 +451,8 @@ No authorization required Logs out current logged in user session + + ### Example ```java @@ -422,6 +460,7 @@ Logs out current logged in user session import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.UserApi; @@ -429,6 +468,12 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); UserApi apiInstance = new UserApi(defaultClient); try { @@ -455,7 +500,7 @@ This endpoint does not need any parameter. ### Authorization -No authorization required +[api_key](../README.md#api_key) ### HTTP request headers @@ -471,7 +516,7 @@ No authorization required ## updateUser -> void updateUser(username, body) +> void updateUser(username, user) Updated user @@ -484,6 +529,7 @@ This can only be done by the logged in user. import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.UserApi; @@ -491,12 +537,18 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); UserApi apiInstance = new UserApi(defaultClient); String username = "username_example"; // String | name that need to be deleted - User body = new User(); // User | Updated user object + User user = new User(); // User | Updated user object try { - void result = apiInstance.updateUser(username, body); + void result = apiInstance.updateUser(username, user); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling UserApi#updateUser"); @@ -515,7 +567,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **username** | **String**| name that need to be deleted | | -| **body** | [**User**](User.md)| Updated user object | | +| **user** | [**User**](User.md)| Updated user object | | ### Return type @@ -523,11 +575,11 @@ public class Example { ### Authorization -No authorization required +[api_key](../README.md#api_key) ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java index fe8f0596df26..e2f50660d37d 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java @@ -37,7 +37,7 @@ * */ -@RegisterRestClient(configKey="petstore") +@RegisterRestClient(configKey="") @RegisterProvider(ApiExceptionMapper.class) @Path("/pet") public interface PetApi { @@ -45,15 +45,20 @@ public interface PetApi { /** * Add a new pet to the store * + * + * */ @POST @Consumes({ "application/json", "application/xml" }) - void addPet(Pet body) throws ApiException, ProcessingException; + @Produces({ "application/xml", "application/json" }) + Pet addPet(Pet pet) throws ApiException, ProcessingException; /** * Deletes a pet * + * + * */ @DELETE @Path("/{petId}") @@ -97,15 +102,20 @@ public interface PetApi { /** * Update an existing pet * + * + * */ @PUT @Consumes({ "application/json", "application/xml" }) - void updatePet(Pet body) throws ApiException, ProcessingException; + @Produces({ "application/xml", "application/json" }) + Pet updatePet(Pet pet) throws ApiException, ProcessingException; /** * Updates a pet in the store with form data * + * + * */ @POST @Path("/{petId}") @@ -115,6 +125,8 @@ public interface PetApi { /** * uploads an image * + * + * */ @POST @Path("/{petId}/uploadImage") diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java index 29466ef6c217..d073935ddc42 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java @@ -35,7 +35,7 @@ * */ -@RegisterRestClient(configKey="petstore") +@RegisterRestClient(configKey="") @RegisterProvider(ApiExceptionMapper.class) @Path("/store") public interface StoreApi { @@ -75,9 +75,12 @@ public interface StoreApi { /** * Place an order for a pet * + * + * */ @POST @Path("/order") + @Consumes({ "application/json" }) @Produces({ "application/xml", "application/json" }) - Order placeOrder(Order body) throws ApiException, ProcessingException; + Order placeOrder(Order order) throws ApiException, ProcessingException; } diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java index d1eb41adcb8b..297eff2184c8 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java @@ -36,7 +36,7 @@ * */ -@RegisterRestClient(configKey="petstore") +@RegisterRestClient(configKey="") @RegisterProvider(ApiExceptionMapper.class) @Path("/user") public interface UserApi { @@ -49,23 +49,30 @@ public interface UserApi { */ @POST - void createUser(User body) throws ApiException, ProcessingException; + @Consumes({ "application/json" }) + void createUser(User user) throws ApiException, ProcessingException; /** * Creates list of users with given input array * + * + * */ @POST @Path("/createWithArray") - void createUsersWithArrayInput(List body) throws ApiException, ProcessingException; + @Consumes({ "application/json" }) + void createUsersWithArrayInput(List user) throws ApiException, ProcessingException; /** * Creates list of users with given input array * + * + * */ @POST @Path("/createWithList") - void createUsersWithListInput(List body) throws ApiException, ProcessingException; + @Consumes({ "application/json" }) + void createUsersWithListInput(List user) throws ApiException, ProcessingException; /** * Delete user @@ -80,6 +87,8 @@ public interface UserApi { /** * Get user by user name * + * + * */ @GET @Path("/{username}") @@ -89,6 +98,8 @@ public interface UserApi { /** * Logs user into the system * + * + * */ @GET @Path("/login") @@ -98,6 +109,8 @@ public interface UserApi { /** * Logs out current logged in user session * + * + * */ @GET @Path("/logout") @@ -111,5 +124,6 @@ public interface UserApi { */ @PUT @Path("/{username}") - void updateUser(@PathParam("username") String username, User body) throws ApiException, ProcessingException; + @Consumes({ "application/json" }) + void updateUser(@PathParam("username") String username, User user) throws ApiException, ProcessingException; } diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Category.java index 1613327e6cf9..d34db0dec2e9 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Category.java @@ -101,3 +101,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 3d3a88c183d1..bb7520afb0b9 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -125,3 +125,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Order.java index d7d4a68d8863..204dc0ceb793 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Order.java @@ -243,3 +243,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java index c0d7cc69efaa..3efc500eec78 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java @@ -216,7 +216,9 @@ public Pet addTagsItem(Tag tagsItem) { /** * pet status in the store * @return status + * @deprecated **/ + @Deprecated public StatusEnum getStatus() { return status; } @@ -263,3 +265,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Tag.java index 541d748c8825..31b194923087 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Tag.java @@ -101,3 +101,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/User.java index 243616b646d0..da9326887b10 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/User.java @@ -248,3 +248,4 @@ private static String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson-3.1/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-gson-3.1/.openapi-generator/FILES index 1f507055a793..2cba97181005 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-gson-3.1/.openapi-generator/FILES @@ -5,6 +5,7 @@ README.md api/openapi.yaml build.gradle build.sbt +docs/AllOfSimpleModel.md docs/Animal.md docs/AnyTypeTest.md docs/ArrayOfSameRef.md @@ -21,6 +22,7 @@ docs/OneOfStringOrInt.md docs/Order.md docs/Pet.md docs/PetApi.md +docs/SimpleModelWithArrayProperty.md docs/StoreApi.md docs/StringOrInt.md docs/Tag.md @@ -61,6 +63,7 @@ src/main/java/org/openapitools/client/auth/OAuthFlow.java src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java src/main/java/org/openapitools/client/auth/RetryingOAuth.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AllOfSimpleModel.java src/main/java/org/openapitools/client/model/Animal.java src/main/java/org/openapitools/client/model/AnyTypeTest.java src/main/java/org/openapitools/client/model/ArrayOfSameRef.java @@ -75,6 +78,7 @@ src/main/java/org/openapitools/client/model/ModelApiResponse.java src/main/java/org/openapitools/client/model/OneOfStringOrInt.java src/main/java/org/openapitools/client/model/Order.java src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java src/main/java/org/openapitools/client/model/StringOrInt.java src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/User.java diff --git a/samples/client/petstore/java/okhttp-gson-3.1/README.md b/samples/client/petstore/java/okhttp-gson-3.1/README.md index 4109d87c8984..dcdf89b21422 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/README.md +++ b/samples/client/petstore/java/okhttp-gson-3.1/README.md @@ -144,6 +144,7 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [AllOfSimpleModel](docs/AllOfSimpleModel.md) - [Animal](docs/Animal.md) - [AnyTypeTest](docs/AnyTypeTest.md) - [ArrayOfSameRef](docs/ArrayOfSameRef.md) @@ -158,6 +159,7 @@ Class | Method | HTTP request | Description - [OneOfStringOrInt](docs/OneOfStringOrInt.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) + - [SimpleModelWithArrayProperty](docs/SimpleModelWithArrayProperty.md) - [StringOrInt](docs/StringOrInt.md) - [Tag](docs/Tag.md) - [User](docs/User.md) diff --git a/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml index 27061efd082c..4f61199e49ad 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml @@ -1063,6 +1063,17 @@ components: - Code 2 - Code 3 type: string + SimpleModelWithArrayProperty: + properties: + arrayOfStrings: + items: + type: string + type: array + required: + - arrayOfStrings + AllOfSimpleModel: + allOf: + - $ref: '#/components/schemas/SimpleModelWithArrayProperty' updatePetWithForm_request: properties: name: diff --git a/samples/client/petstore/java/okhttp-gson-3.1/docs/AllOfSimpleModel.md b/samples/client/petstore/java/okhttp-gson-3.1/docs/AllOfSimpleModel.md new file mode 100644 index 000000000000..de96aa498bd8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-3.1/docs/AllOfSimpleModel.md @@ -0,0 +1,13 @@ + + +# AllOfSimpleModel + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfStrings** | **List<String>** | | | + + + diff --git a/samples/client/petstore/java/okhttp-gson-3.1/docs/SimpleModelWithArrayProperty.md b/samples/client/petstore/java/okhttp-gson-3.1/docs/SimpleModelWithArrayProperty.md new file mode 100644 index 000000000000..17737af5ceb2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-3.1/docs/SimpleModelWithArrayProperty.md @@ -0,0 +1,13 @@ + + +# SimpleModelWithArrayProperty + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfStrings** | **List<String>** | | | + + + diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java index d5949d405485..f5823fd75224 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java @@ -129,6 +129,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfSimpleModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AnyTypeTest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfSameRef.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Cat.CustomTypeAdapterFactory()); @@ -141,6 +142,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OneOfStringOrInt.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SimpleModelWithArrayProperty.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StringOrInt.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java new file mode 100644 index 000000000000..1bb4d2355d9e --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java @@ -0,0 +1,308 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfSimpleModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class AllOfSimpleModel { + public static final String SERIALIZED_NAME_ARRAY_OF_STRINGS = "arrayOfStrings"; + @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRINGS) + private List arrayOfStrings = new ArrayList<>(); + + public AllOfSimpleModel() { + } + + public AllOfSimpleModel arrayOfStrings(List arrayOfStrings) { + this.arrayOfStrings = arrayOfStrings; + return this; + } + + public AllOfSimpleModel addArrayOfStringsItem(String arrayOfStringsItem) { + if (this.arrayOfStrings == null) { + this.arrayOfStrings = new ArrayList<>(); + } + this.arrayOfStrings.add(arrayOfStringsItem); + return this; + } + + /** + * Get arrayOfStrings + * @return arrayOfStrings + **/ + @javax.annotation.Nonnull + public List getArrayOfStrings() { + return arrayOfStrings; + } + + public void setArrayOfStrings(List arrayOfStrings) { + this.arrayOfStrings = arrayOfStrings; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfSimpleModel instance itself + */ + public AllOfSimpleModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfSimpleModel allOfSimpleModel = (AllOfSimpleModel) o; + return Objects.equals(this.arrayOfStrings, allOfSimpleModel.arrayOfStrings)&& + Objects.equals(this.additionalProperties, allOfSimpleModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfStrings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfSimpleModel {\n"); + sb.append(" arrayOfStrings: ").append(toIndentedString(arrayOfStrings)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("arrayOfStrings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("arrayOfStrings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfSimpleModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfSimpleModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllOfSimpleModel is not found in the empty JSON string", AllOfSimpleModel.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllOfSimpleModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("arrayOfStrings") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("arrayOfStrings").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `arrayOfStrings` to be an array in the JSON string but got `%s`", jsonObj.get("arrayOfStrings").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfSimpleModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfSimpleModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfSimpleModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfSimpleModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfSimpleModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfSimpleModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfSimpleModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfSimpleModel + * @throws IOException if the JSON string is invalid with respect to AllOfSimpleModel + */ + public static AllOfSimpleModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfSimpleModel.class); + } + + /** + * Convert an instance of AllOfSimpleModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java new file mode 100644 index 000000000000..eb3053a4efa2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java @@ -0,0 +1,308 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SimpleModelWithArrayProperty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class SimpleModelWithArrayProperty { + public static final String SERIALIZED_NAME_ARRAY_OF_STRINGS = "arrayOfStrings"; + @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRINGS) + private List arrayOfStrings = new ArrayList<>(); + + public SimpleModelWithArrayProperty() { + } + + public SimpleModelWithArrayProperty arrayOfStrings(List arrayOfStrings) { + this.arrayOfStrings = arrayOfStrings; + return this; + } + + public SimpleModelWithArrayProperty addArrayOfStringsItem(String arrayOfStringsItem) { + if (this.arrayOfStrings == null) { + this.arrayOfStrings = new ArrayList<>(); + } + this.arrayOfStrings.add(arrayOfStringsItem); + return this; + } + + /** + * Get arrayOfStrings + * @return arrayOfStrings + **/ + @javax.annotation.Nonnull + public List getArrayOfStrings() { + return arrayOfStrings; + } + + public void setArrayOfStrings(List arrayOfStrings) { + this.arrayOfStrings = arrayOfStrings; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SimpleModelWithArrayProperty instance itself + */ + public SimpleModelWithArrayProperty putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SimpleModelWithArrayProperty simpleModelWithArrayProperty = (SimpleModelWithArrayProperty) o; + return Objects.equals(this.arrayOfStrings, simpleModelWithArrayProperty.arrayOfStrings)&& + Objects.equals(this.additionalProperties, simpleModelWithArrayProperty.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfStrings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SimpleModelWithArrayProperty {\n"); + sb.append(" arrayOfStrings: ").append(toIndentedString(arrayOfStrings)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("arrayOfStrings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("arrayOfStrings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimpleModelWithArrayProperty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SimpleModelWithArrayProperty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SimpleModelWithArrayProperty is not found in the empty JSON string", SimpleModelWithArrayProperty.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SimpleModelWithArrayProperty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("arrayOfStrings") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("arrayOfStrings").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `arrayOfStrings` to be an array in the JSON string but got `%s`", jsonObj.get("arrayOfStrings").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SimpleModelWithArrayProperty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimpleModelWithArrayProperty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SimpleModelWithArrayProperty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SimpleModelWithArrayProperty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SimpleModelWithArrayProperty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SimpleModelWithArrayProperty instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SimpleModelWithArrayProperty given an JSON string + * + * @param jsonString JSON string + * @return An instance of SimpleModelWithArrayProperty + * @throws IOException if the JSON string is invalid with respect to SimpleModelWithArrayProperty + */ + public static SimpleModelWithArrayProperty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SimpleModelWithArrayProperty.class); + } + + /** + * Convert an instance of SimpleModelWithArrayProperty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/test/java/org/openapitools/client/model/AllOfSimpleModelTest.java b/samples/client/petstore/java/okhttp-gson-3.1/src/test/java/org/openapitools/client/model/AllOfSimpleModelTest.java new file mode 100644 index 000000000000..3afe85fb5f69 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/test/java/org/openapitools/client/model/AllOfSimpleModelTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfSimpleModel + */ +public class AllOfSimpleModelTest { + private final AllOfSimpleModel model = new AllOfSimpleModel(); + + /** + * Model tests for AllOfSimpleModel + */ + @Test + public void testAllOfSimpleModel() { + // TODO: test AllOfSimpleModel + } + + /** + * Test the property 'arrayOfStrings' + */ + @Test + public void arrayOfStringsTest() { + // TODO: test arrayOfStrings + } + +} diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java b/samples/client/petstore/java/okhttp-gson-3.1/src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java new file mode 100644 index 000000000000..7368878c9ab6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleModelWithArrayProperty + */ +public class SimpleModelWithArrayPropertyTest { + private final SimpleModelWithArrayProperty model = new SimpleModelWithArrayProperty(); + + /** + * Model tests for SimpleModelWithArrayProperty + */ + @Test + public void testSimpleModelWithArrayProperty() { + // TODO: test SimpleModelWithArrayProperty + } + + /** + * Test the property 'arrayOfStrings' + */ + @Test + public void arrayOfStringsTest() { + // TODO: test arrayOfStrings + } + +} diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 3d717080f4e3..c369a0f2e0ab 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -156,5 +156,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private AdditionalPropertiesClass instance; + + public Builder() { + this(new AdditionalPropertiesClass()); + } + + protected Builder(AdditionalPropertiesClass instance) { + this.instance = instance; + } + + public AdditionalPropertiesClass.Builder mapProperty(Map mapProperty) { + this.instance.mapProperty = mapProperty; + return this; + } + public AdditionalPropertiesClass.Builder mapOfMapProperty(Map> mapOfMapProperty) { + this.instance.mapOfMapProperty = mapOfMapProperty; + return this; + } + + + /** + * returns a built AdditionalPropertiesClass instance. + * + * The builder is not reusable. + */ + public AdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AdditionalPropertiesClass.Builder builder() { + return new AdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesClass.Builder toBuilder() { + return new AdditionalPropertiesClass.Builder() + .mapProperty(getMapProperty()) + .mapOfMapProperty(getMapOfMapProperty()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java index 5a77bf23384e..35c2e78eeb72 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java @@ -139,5 +139,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private AllOfWithSingleRef instance; + + public Builder() { + this(new AllOfWithSingleRef()); + } + + protected Builder(AllOfWithSingleRef instance) { + this.instance = instance; + } + + public AllOfWithSingleRef.Builder username(String username) { + this.instance.username = username; + return this; + } + public AllOfWithSingleRef.Builder singleRefType(SingleRefType singleRefType) { + this.instance.singleRefType = singleRefType; + return this; + } + + + /** + * returns a built AllOfWithSingleRef instance. + * + * The builder is not reusable. + */ + public AllOfWithSingleRef build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AllOfWithSingleRef.Builder builder() { + return new AllOfWithSingleRef.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AllOfWithSingleRef.Builder toBuilder() { + return new AllOfWithSingleRef.Builder() + .username(getUsername()) + .singleRefType(getSingleRefType()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java index 6693afeb06f3..c444d76130e4 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java @@ -151,5 +151,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Animal instance; + + public Builder() { + this(new Animal()); + } + + protected Builder(Animal instance) { + this.instance = instance; + } + + public Animal.Builder className(String className) { + this.instance.className = className; + return this; + } + public Animal.Builder color(String color) { + this.instance.color = color; + return this; + } + + + /** + * returns a built Animal instance. + * + * The builder is not reusable. + */ + public Animal build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Animal.Builder builder() { + return new Animal.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Animal.Builder toBuilder() { + return new Animal.Builder() + .className(getClassName()) + .color(getColor()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index b08931a78174..45abfb5c76c5 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -118,5 +118,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ArrayOfArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfArrayOfNumberOnly()); + } + + protected Builder(ArrayOfArrayOfNumberOnly instance) { + this.instance = instance; + } + + public ArrayOfArrayOfNumberOnly.Builder arrayArrayNumber(List> arrayArrayNumber) { + this.instance.arrayArrayNumber = arrayArrayNumber; + return this; + } + + + /** + * returns a built ArrayOfArrayOfNumberOnly instance. + * + * The builder is not reusable. + */ + public ArrayOfArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayOfArrayOfNumberOnly.Builder builder() { + return new ArrayOfArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfArrayOfNumberOnly.Builder toBuilder() { + return new ArrayOfArrayOfNumberOnly.Builder() + .arrayArrayNumber(getArrayArrayNumber()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index e3c28990a871..fff46bca0b73 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -118,5 +118,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfNumberOnly()); + } + + protected Builder(ArrayOfNumberOnly instance) { + this.instance = instance; + } + + public ArrayOfNumberOnly.Builder arrayNumber(List arrayNumber) { + this.instance.arrayNumber = arrayNumber; + return this; + } + + + /** + * returns a built ArrayOfNumberOnly instance. + * + * The builder is not reusable. + */ + public ArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayOfNumberOnly.Builder builder() { + return new ArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfNumberOnly.Builder toBuilder() { + return new ArrayOfNumberOnly.Builder() + .arrayNumber(getArrayNumber()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java index 94c3e22c304b..9cdf71c6e69c 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -198,5 +198,69 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ArrayTest instance; + + public Builder() { + this(new ArrayTest()); + } + + protected Builder(ArrayTest instance) { + this.instance = instance; + } + + public ArrayTest.Builder arrayOfString(List arrayOfString) { + this.instance.arrayOfString = arrayOfString; + return this; + } + public ArrayTest.Builder arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.instance.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + public ArrayTest.Builder arrayArrayOfModel(List> arrayArrayOfModel) { + this.instance.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + + /** + * returns a built ArrayTest instance. + * + * The builder is not reusable. + */ + public ArrayTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayTest.Builder builder() { + return new ArrayTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayTest.Builder toBuilder() { + return new ArrayTest.Builder() + .arrayOfString(getArrayOfString()) + .arrayArrayOfInteger(getArrayArrayOfInteger()) + .arrayArrayOfModel(getArrayArrayOfModel()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java index 2153176018bb..2ba31cef7d30 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java @@ -266,5 +266,84 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Capitalization instance; + + public Builder() { + this(new Capitalization()); + } + + protected Builder(Capitalization instance) { + this.instance = instance; + } + + public Capitalization.Builder smallCamel(String smallCamel) { + this.instance.smallCamel = smallCamel; + return this; + } + public Capitalization.Builder capitalCamel(String capitalCamel) { + this.instance.capitalCamel = capitalCamel; + return this; + } + public Capitalization.Builder smallSnake(String smallSnake) { + this.instance.smallSnake = smallSnake; + return this; + } + public Capitalization.Builder capitalSnake(String capitalSnake) { + this.instance.capitalSnake = capitalSnake; + return this; + } + public Capitalization.Builder scAETHFlowPoints(String scAETHFlowPoints) { + this.instance.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + public Capitalization.Builder ATT_NAME(String ATT_NAME) { + this.instance.ATT_NAME = ATT_NAME; + return this; + } + + + /** + * returns a built Capitalization instance. + * + * The builder is not reusable. + */ + public Capitalization build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Capitalization.Builder builder() { + return new Capitalization.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Capitalization.Builder toBuilder() { + return new Capitalization.Builder() + .smallCamel(getSmallCamel()) + .capitalCamel(getCapitalCamel()) + .smallSnake(getSmallSnake()) + .capitalSnake(getCapitalSnake()) + .scAETHFlowPoints(getScAETHFlowPoints()) + .ATT_NAME(getATTNAME()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java index 2332f820a37e..977a2f47eb4c 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java @@ -132,5 +132,73 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder extends Animal.Builder { + + private Cat instance; + + public Builder() { + this(new Cat()); + } + + protected Builder(Cat instance) { + super(instance); + this.instance = instance; + } + + public Cat.Builder declawed(Boolean declawed) { + this.instance.declawed = declawed; + return this; + } + + public Cat.Builder className(String className) { // inherited: true + super.className(className); + return this; + } + + public Cat.Builder color(String color) { // inherited: true + super.color(color); + return this; + } + + + /** + * returns a built Cat instance. + * + * The builder is not reusable. + */ + public Cat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Cat.Builder builder() { + return new Cat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Cat.Builder toBuilder() { + return new Cat.Builder() + .className(getClassName()) + .color(getColor()) + .declawed(getDeclawed()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java index db90b22d2cc0..ca18702c2cf2 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java @@ -138,5 +138,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Category instance; + + public Builder() { + this(new Category()); + } + + protected Builder(Category instance) { + this.instance = instance; + } + + public Category.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Category.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built Category instance. + * + * The builder is not reusable. + */ + public Category build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Category.Builder builder() { + return new Category.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Category.Builder toBuilder() { + return new Category.Builder() + .id(getId()) + .name(getName()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ChildWithNullable.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ChildWithNullable.java index 0fcfd2e82bf4..70ea145ffcb8 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ChildWithNullable.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ChildWithNullable.java @@ -144,5 +144,77 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder extends ParentWithNullable.Builder { + + private ChildWithNullable instance; + + public Builder() { + this(new ChildWithNullable()); + } + + protected Builder(ChildWithNullable instance) { + super(instance); + this.instance = instance; + } + + public ChildWithNullable.Builder otherProperty(String otherProperty) { + this.instance.otherProperty = otherProperty; + return this; + } + + public ChildWithNullable.Builder type(TypeEnum type) { // inherited: true + super.type(type); + return this; + } + + public ChildWithNullable.Builder nullableProperty(String nullableProperty) { // inherited: true + super.nullableProperty(nullableProperty); + return this; + } + public ChildWithNullable.Builder nullableProperty(JsonNullable nullableProperty) { + this.instance.nullableProperty = nullableProperty; + return this; + } + + + /** + * returns a built ChildWithNullable instance. + * + * The builder is not reusable. + */ + public ChildWithNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ChildWithNullable.Builder builder() { + return new ChildWithNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ChildWithNullable.Builder toBuilder() { + return new ChildWithNullable.Builder() + .type(getType()) + .nullableProperty(getNullableProperty()) + .otherProperty(getOtherProperty()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java index 6bb5958e9b47..450a4b006b59 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java @@ -106,5 +106,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ClassModel instance; + + public Builder() { + this(new ClassModel()); + } + + protected Builder(ClassModel instance) { + this.instance = instance; + } + + public ClassModel.Builder propertyClass(String propertyClass) { + this.instance.propertyClass = propertyClass; + return this; + } + + + /** + * returns a built ClassModel instance. + * + * The builder is not reusable. + */ + public ClassModel build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ClassModel.Builder builder() { + return new ClassModel.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ClassModel.Builder toBuilder() { + return new ClassModel.Builder() + .propertyClass(getPropertyClass()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java index 7c6b6d4c7992..4a576df513d4 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java @@ -106,5 +106,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Client instance; + + public Builder() { + this(new Client()); + } + + protected Builder(Client instance) { + this.instance = instance; + } + + public Client.Builder client(String client) { + this.instance.client = client; + return this; + } + + + /** + * returns a built Client instance. + * + * The builder is not reusable. + */ + public Client build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Client.Builder builder() { + return new Client.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Client.Builder toBuilder() { + return new Client.Builder() + .client(getClient()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DeprecatedObject.java index 196f0c5340cd..1e3733259f9f 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -108,5 +108,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private DeprecatedObject instance; + + public Builder() { + this(new DeprecatedObject()); + } + + protected Builder(DeprecatedObject instance) { + this.instance = instance; + } + + public DeprecatedObject.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built DeprecatedObject instance. + * + * The builder is not reusable. + */ + public DeprecatedObject build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static DeprecatedObject.Builder builder() { + return new DeprecatedObject.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public DeprecatedObject.Builder toBuilder() { + return new DeprecatedObject.Builder() + .name(getName()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java index e3f7dd0a02c8..6e19d24e25e9 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java @@ -132,5 +132,73 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder extends Animal.Builder { + + private Dog instance; + + public Builder() { + this(new Dog()); + } + + protected Builder(Dog instance) { + super(instance); + this.instance = instance; + } + + public Dog.Builder breed(String breed) { + this.instance.breed = breed; + return this; + } + + public Dog.Builder className(String className) { // inherited: true + super.className(className); + return this; + } + + public Dog.Builder color(String color) { // inherited: true + super.color(color); + return this; + } + + + /** + * returns a built Dog instance. + * + * The builder is not reusable. + */ + public Dog build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Dog.Builder builder() { + return new Dog.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Dog.Builder toBuilder() { + return new Dog.Builder() + .className(getClassName()) + .color(getColor()) + .breed(getBreed()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java index 8c0470467c6e..2d4c6b8a979a 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -219,5 +219,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private EnumArrays instance; + + public Builder() { + this(new EnumArrays()); + } + + protected Builder(EnumArrays instance) { + this.instance = instance; + } + + public EnumArrays.Builder justSymbol(JustSymbolEnum justSymbol) { + this.instance.justSymbol = justSymbol; + return this; + } + public EnumArrays.Builder arrayEnum(List arrayEnum) { + this.instance.arrayEnum = arrayEnum; + return this; + } + + + /** + * returns a built EnumArrays instance. + * + * The builder is not reusable. + */ + public EnumArrays build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static EnumArrays.Builder builder() { + return new EnumArrays.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumArrays.Builder toBuilder() { + return new EnumArrays.Builder() + .justSymbol(getJustSymbol()) + .arrayEnum(getArrayEnum()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java index fda5fa5b6b62..add6575e0a98 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java @@ -502,5 +502,98 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private EnumTest instance; + + public Builder() { + this(new EnumTest()); + } + + protected Builder(EnumTest instance) { + this.instance = instance; + } + + public EnumTest.Builder enumString(EnumStringEnum enumString) { + this.instance.enumString = enumString; + return this; + } + public EnumTest.Builder enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.instance.enumStringRequired = enumStringRequired; + return this; + } + public EnumTest.Builder enumInteger(EnumIntegerEnum enumInteger) { + this.instance.enumInteger = enumInteger; + return this; + } + public EnumTest.Builder enumNumber(EnumNumberEnum enumNumber) { + this.instance.enumNumber = enumNumber; + return this; + } + public EnumTest.Builder outerEnum(OuterEnum outerEnum) { + this.instance.outerEnum = JsonNullable.of(outerEnum); + return this; + } + public EnumTest.Builder outerEnum(JsonNullable outerEnum) { + this.instance.outerEnum = outerEnum; + return this; + } + public EnumTest.Builder outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.instance.outerEnumInteger = outerEnumInteger; + return this; + } + public EnumTest.Builder outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.instance.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + public EnumTest.Builder outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.instance.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + + /** + * returns a built EnumTest instance. + * + * The builder is not reusable. + */ + public EnumTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static EnumTest.Builder builder() { + return new EnumTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumTest.Builder toBuilder() { + return new EnumTest.Builder() + .enumString(getEnumString()) + .enumStringRequired(getEnumStringRequired()) + .enumInteger(getEnumInteger()) + .enumNumber(getEnumNumber()) + .outerEnum(getOuterEnum()) + .outerEnumInteger(getOuterEnumInteger()) + .outerEnumDefaultValue(getOuterEnumDefaultValue()) + .outerEnumIntegerDefaultValue(getOuterEnumIntegerDefaultValue()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java index 45ff11851c97..4af66beca82e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -150,5 +150,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private FakeBigDecimalMap200Response instance; + + public Builder() { + this(new FakeBigDecimalMap200Response()); + } + + protected Builder(FakeBigDecimalMap200Response instance) { + this.instance = instance; + } + + public FakeBigDecimalMap200Response.Builder someId(BigDecimal someId) { + this.instance.someId = someId; + return this; + } + public FakeBigDecimalMap200Response.Builder someMap(Map someMap) { + this.instance.someMap = someMap; + return this; + } + + + /** + * returns a built FakeBigDecimalMap200Response instance. + * + * The builder is not reusable. + */ + public FakeBigDecimalMap200Response build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FakeBigDecimalMap200Response.Builder builder() { + return new FakeBigDecimalMap200Response.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FakeBigDecimalMap200Response.Builder toBuilder() { + return new FakeBigDecimalMap200Response.Builder() + .someId(getSomeId()) + .someMap(getSomeMap()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index aa09b8c4383d..544a958564b0 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -150,5 +150,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private FileSchemaTestClass instance; + + public Builder() { + this(new FileSchemaTestClass()); + } + + protected Builder(FileSchemaTestClass instance) { + this.instance = instance; + } + + public FileSchemaTestClass.Builder _file(ModelFile _file) { + this.instance._file = _file; + return this; + } + public FileSchemaTestClass.Builder files(List files) { + this.instance.files = files; + return this; + } + + + /** + * returns a built FileSchemaTestClass instance. + * + * The builder is not reusable. + */ + public FileSchemaTestClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FileSchemaTestClass.Builder builder() { + return new FileSchemaTestClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileSchemaTestClass.Builder toBuilder() { + return new FileSchemaTestClass.Builder() + ._file(getFile()) + .files(getFiles()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Foo.java index 52baa4bbfd9e..fe2af3988ee6 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Foo.java @@ -106,5 +106,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Foo instance; + + public Builder() { + this(new Foo()); + } + + protected Builder(Foo instance) { + this.instance = instance; + } + + public Foo.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + + + /** + * returns a built Foo instance. + * + * The builder is not reusable. + */ + public Foo build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Foo.Builder builder() { + return new Foo.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Foo.Builder toBuilder() { + return new Foo.Builder() + .bar(getBar()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 2b266cae697b..70a12d6c7e09 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -108,5 +108,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private FooGetDefaultResponse instance; + + public Builder() { + this(new FooGetDefaultResponse()); + } + + protected Builder(FooGetDefaultResponse instance) { + this.instance = instance; + } + + public FooGetDefaultResponse.Builder string(Foo string) { + this.instance.string = string; + return this; + } + + + /** + * returns a built FooGetDefaultResponse instance. + * + * The builder is not reusable. + */ + public FooGetDefaultResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FooGetDefaultResponse.Builder builder() { + return new FooGetDefaultResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FooGetDefaultResponse.Builder toBuilder() { + return new FooGetDefaultResponse.Builder() + .string(getString()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java index b1a8b4f26282..5ff76a8a9cc6 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java @@ -602,5 +602,134 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private FormatTest instance; + + public Builder() { + this(new FormatTest()); + } + + protected Builder(FormatTest instance) { + this.instance = instance; + } + + public FormatTest.Builder integer(Integer integer) { + this.instance.integer = integer; + return this; + } + public FormatTest.Builder int32(Integer int32) { + this.instance.int32 = int32; + return this; + } + public FormatTest.Builder int64(Long int64) { + this.instance.int64 = int64; + return this; + } + public FormatTest.Builder number(BigDecimal number) { + this.instance.number = number; + return this; + } + public FormatTest.Builder _float(Float _float) { + this.instance._float = _float; + return this; + } + public FormatTest.Builder _double(Double _double) { + this.instance._double = _double; + return this; + } + public FormatTest.Builder decimal(BigDecimal decimal) { + this.instance.decimal = decimal; + return this; + } + public FormatTest.Builder string(String string) { + this.instance.string = string; + return this; + } + public FormatTest.Builder _byte(byte[] _byte) { + this.instance._byte = _byte; + return this; + } + public FormatTest.Builder binary(File binary) { + this.instance.binary = binary; + return this; + } + public FormatTest.Builder date(LocalDate date) { + this.instance.date = date; + return this; + } + public FormatTest.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime = dateTime; + return this; + } + public FormatTest.Builder uuid(UUID uuid) { + this.instance.uuid = uuid; + return this; + } + public FormatTest.Builder password(String password) { + this.instance.password = password; + return this; + } + public FormatTest.Builder patternWithDigits(String patternWithDigits) { + this.instance.patternWithDigits = patternWithDigits; + return this; + } + public FormatTest.Builder patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.instance.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + + /** + * returns a built FormatTest instance. + * + * The builder is not reusable. + */ + public FormatTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FormatTest.Builder builder() { + return new FormatTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FormatTest.Builder toBuilder() { + return new FormatTest.Builder() + .integer(getInteger()) + .int32(getInt32()) + .int64(getInt64()) + .number(getNumber()) + ._float(getFloat()) + ._double(getDouble()) + .decimal(getDecimal()) + .string(getString()) + ._byte(getByte()) + .binary(getBinary()) + .date(getDate()) + .dateTime(getDateTime()) + .uuid(getUuid()) + .password(getPassword()) + .patternWithDigits(getPatternWithDigits()) + .patternWithDigitsAndDelimiter(getPatternWithDigitsAndDelimiter()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 382c30d1bb73..2814acc80620 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -121,5 +121,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private HasOnlyReadOnly instance; + + public Builder() { + this(new HasOnlyReadOnly()); + } + + protected Builder(HasOnlyReadOnly instance) { + this.instance = instance; + } + + public HasOnlyReadOnly.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + public HasOnlyReadOnly.Builder foo(String foo) { + this.instance.foo = foo; + return this; + } + + + /** + * returns a built HasOnlyReadOnly instance. + * + * The builder is not reusable. + */ + public HasOnlyReadOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static HasOnlyReadOnly.Builder builder() { + return new HasOnlyReadOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public HasOnlyReadOnly.Builder toBuilder() { + return new HasOnlyReadOnly.Builder() + .bar(getBar()) + .foo(getFoo()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HealthCheckResult.java index 9047d758d174..719dcb90370b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -129,5 +129,63 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private HealthCheckResult instance; + + public Builder() { + this(new HealthCheckResult()); + } + + protected Builder(HealthCheckResult instance) { + this.instance = instance; + } + + public HealthCheckResult.Builder nullableMessage(String nullableMessage) { + this.instance.nullableMessage = JsonNullable.of(nullableMessage); + return this; + } + public HealthCheckResult.Builder nullableMessage(JsonNullable nullableMessage) { + this.instance.nullableMessage = nullableMessage; + return this; + } + + + /** + * returns a built HealthCheckResult instance. + * + * The builder is not reusable. + */ + public HealthCheckResult build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static HealthCheckResult.Builder builder() { + return new HealthCheckResult.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public HealthCheckResult.Builder toBuilder() { + return new HealthCheckResult.Builder() + .nullableMessage(getNullableMessage()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java index 1520c3cb11f6..32c537537138 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java @@ -271,5 +271,74 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private MapTest instance; + + public Builder() { + this(new MapTest()); + } + + protected Builder(MapTest instance) { + this.instance = instance; + } + + public MapTest.Builder mapMapOfString(Map> mapMapOfString) { + this.instance.mapMapOfString = mapMapOfString; + return this; + } + public MapTest.Builder mapOfEnumString(Map mapOfEnumString) { + this.instance.mapOfEnumString = mapOfEnumString; + return this; + } + public MapTest.Builder directMap(Map directMap) { + this.instance.directMap = directMap; + return this; + } + public MapTest.Builder indirectMap(Map indirectMap) { + this.instance.indirectMap = indirectMap; + return this; + } + + + /** + * returns a built MapTest instance. + * + * The builder is not reusable. + */ + public MapTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static MapTest.Builder builder() { + return new MapTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MapTest.Builder toBuilder() { + return new MapTest.Builder() + .mapMapOfString(getMapMapOfString()) + .mapOfEnumString(getMapOfEnumString()) + .directMap(getDirectMap()) + .indirectMap(getIndirectMap()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 2b0ba18327b1..effd02165bdf 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -183,5 +183,69 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private MixedPropertiesAndAdditionalPropertiesClass instance; + + public Builder() { + this(new MixedPropertiesAndAdditionalPropertiesClass()); + } + + protected Builder(MixedPropertiesAndAdditionalPropertiesClass instance) { + this.instance = instance; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder uuid(UUID uuid) { + this.instance.uuid = uuid; + return this; + } + public MixedPropertiesAndAdditionalPropertiesClass.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime = dateTime; + return this; + } + public MixedPropertiesAndAdditionalPropertiesClass.Builder map(Map map) { + this.instance.map = map; + return this; + } + + + /** + * returns a built MixedPropertiesAndAdditionalPropertiesClass instance. + * + * The builder is not reusable. + */ + public MixedPropertiesAndAdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static MixedPropertiesAndAdditionalPropertiesClass.Builder builder() { + return new MixedPropertiesAndAdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MixedPropertiesAndAdditionalPropertiesClass.Builder toBuilder() { + return new MixedPropertiesAndAdditionalPropertiesClass.Builder() + .uuid(getUuid()) + .dateTime(getDateTime()) + .map(getMap()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java index a514d303f208..d2b87a8bd041 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java @@ -139,5 +139,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Model200Response instance; + + public Builder() { + this(new Model200Response()); + } + + protected Builder(Model200Response instance) { + this.instance = instance; + } + + public Model200Response.Builder name(Integer name) { + this.instance.name = name; + return this; + } + public Model200Response.Builder propertyClass(String propertyClass) { + this.instance.propertyClass = propertyClass; + return this; + } + + + /** + * returns a built Model200Response instance. + * + * The builder is not reusable. + */ + public Model200Response build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Model200Response.Builder builder() { + return new Model200Response.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Model200Response.Builder toBuilder() { + return new Model200Response.Builder() + .name(getName()) + .propertyClass(getPropertyClass()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 94bb9257d593..1c4a06aac6e3 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -171,5 +171,69 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ModelApiResponse instance; + + public Builder() { + this(new ModelApiResponse()); + } + + protected Builder(ModelApiResponse instance) { + this.instance = instance; + } + + public ModelApiResponse.Builder code(Integer code) { + this.instance.code = code; + return this; + } + public ModelApiResponse.Builder type(String type) { + this.instance.type = type; + return this; + } + public ModelApiResponse.Builder message(String message) { + this.instance.message = message; + return this; + } + + + /** + * returns a built ModelApiResponse instance. + * + * The builder is not reusable. + */ + public ModelApiResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelApiResponse.Builder builder() { + return new ModelApiResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelApiResponse.Builder toBuilder() { + return new ModelApiResponse.Builder() + .code(getCode()) + .type(getType()) + .message(getMessage()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelFile.java index 8bb3ebde92f6..5a883db176f1 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelFile.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ModelFile instance; + + public Builder() { + this(new ModelFile()); + } + + protected Builder(ModelFile instance) { + this.instance = instance; + } + + public ModelFile.Builder sourceURI(String sourceURI) { + this.instance.sourceURI = sourceURI; + return this; + } + + + /** + * returns a built ModelFile instance. + * + * The builder is not reusable. + */ + public ModelFile build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelFile.Builder builder() { + return new ModelFile.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelFile.Builder toBuilder() { + return new ModelFile.Builder() + .sourceURI(getSourceURI()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelList.java index 1793d6b4eb34..18cb020faf5b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelList.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ModelList instance; + + public Builder() { + this(new ModelList()); + } + + protected Builder(ModelList instance) { + this.instance = instance; + } + + public ModelList.Builder _123list(String _123list) { + this.instance._123list = _123list; + return this; + } + + + /** + * returns a built ModelList instance. + * + * The builder is not reusable. + */ + public ModelList build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelList.Builder builder() { + return new ModelList.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelList.Builder toBuilder() { + return new ModelList.Builder() + ._123list(get123list()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java index 4d9c567ff4ff..94b36fa79f6b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ModelReturn instance; + + public Builder() { + this(new ModelReturn()); + } + + protected Builder(ModelReturn instance) { + this.instance = instance; + } + + public ModelReturn.Builder _return(Integer _return) { + this.instance._return = _return; + return this; + } + + + /** + * returns a built ModelReturn instance. + * + * The builder is not reusable. + */ + public ModelReturn build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelReturn.Builder builder() { + return new ModelReturn.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelReturn.Builder toBuilder() { + return new ModelReturn.Builder() + ._return(getReturn()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java index db440c74d54f..eb859086d4b9 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java @@ -192,5 +192,74 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Name instance; + + public Builder() { + this(new Name()); + } + + protected Builder(Name instance) { + this.instance = instance; + } + + public Name.Builder name(Integer name) { + this.instance.name = name; + return this; + } + public Name.Builder snakeCase(Integer snakeCase) { + this.instance.snakeCase = snakeCase; + return this; + } + public Name.Builder property(String property) { + this.instance.property = property; + return this; + } + public Name.Builder _123number(Integer _123number) { + this.instance._123number = _123number; + return this; + } + + + /** + * returns a built Name instance. + * + * The builder is not reusable. + */ + public Name build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Name.Builder builder() { + return new Name.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Name.Builder toBuilder() { + return new Name.Builder() + .name(getName()) + .snakeCase(getSnakeCase()) + .property(getProperty()) + ._123number(get123number()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java index 6078cbcdff51..b76b998b4dd7 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java @@ -629,5 +629,154 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private NullableClass instance; + + public Builder() { + this(new NullableClass()); + } + + protected Builder(NullableClass instance) { + this.instance = instance; + } + + public NullableClass.Builder integerProp(Integer integerProp) { + this.instance.integerProp = JsonNullable.of(integerProp); + return this; + } + public NullableClass.Builder integerProp(JsonNullable integerProp) { + this.instance.integerProp = integerProp; + return this; + } + public NullableClass.Builder numberProp(BigDecimal numberProp) { + this.instance.numberProp = JsonNullable.of(numberProp); + return this; + } + public NullableClass.Builder numberProp(JsonNullable numberProp) { + this.instance.numberProp = numberProp; + return this; + } + public NullableClass.Builder booleanProp(Boolean booleanProp) { + this.instance.booleanProp = JsonNullable.of(booleanProp); + return this; + } + public NullableClass.Builder booleanProp(JsonNullable booleanProp) { + this.instance.booleanProp = booleanProp; + return this; + } + public NullableClass.Builder stringProp(String stringProp) { + this.instance.stringProp = JsonNullable.of(stringProp); + return this; + } + public NullableClass.Builder stringProp(JsonNullable stringProp) { + this.instance.stringProp = stringProp; + return this; + } + public NullableClass.Builder dateProp(LocalDate dateProp) { + this.instance.dateProp = JsonNullable.of(dateProp); + return this; + } + public NullableClass.Builder dateProp(JsonNullable dateProp) { + this.instance.dateProp = dateProp; + return this; + } + public NullableClass.Builder datetimeProp(OffsetDateTime datetimeProp) { + this.instance.datetimeProp = JsonNullable.of(datetimeProp); + return this; + } + public NullableClass.Builder datetimeProp(JsonNullable datetimeProp) { + this.instance.datetimeProp = datetimeProp; + return this; + } + public NullableClass.Builder arrayNullableProp(List arrayNullableProp) { + this.instance.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + return this; + } + public NullableClass.Builder arrayNullableProp(JsonNullable> arrayNullableProp) { + this.instance.arrayNullableProp = arrayNullableProp; + return this; + } + public NullableClass.Builder arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.instance.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + return this; + } + public NullableClass.Builder arrayAndItemsNullableProp(JsonNullable> arrayAndItemsNullableProp) { + this.instance.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + public NullableClass.Builder arrayItemsNullable(List arrayItemsNullable) { + this.instance.arrayItemsNullable = arrayItemsNullable; + return this; + } + public NullableClass.Builder objectNullableProp(Map objectNullableProp) { + this.instance.objectNullableProp = JsonNullable.>of(objectNullableProp); + return this; + } + public NullableClass.Builder objectNullableProp(JsonNullable> objectNullableProp) { + this.instance.objectNullableProp = objectNullableProp; + return this; + } + public NullableClass.Builder objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.instance.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + return this; + } + public NullableClass.Builder objectAndItemsNullableProp(JsonNullable> objectAndItemsNullableProp) { + this.instance.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + public NullableClass.Builder objectItemsNullable(Map objectItemsNullable) { + this.instance.objectItemsNullable = objectItemsNullable; + return this; + } + + + /** + * returns a built NullableClass instance. + * + * The builder is not reusable. + */ + public NullableClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static NullableClass.Builder builder() { + return new NullableClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NullableClass.Builder toBuilder() { + return new NullableClass.Builder() + .integerProp(getIntegerProp()) + .numberProp(getNumberProp()) + .booleanProp(getBooleanProp()) + .stringProp(getStringProp()) + .dateProp(getDateProp()) + .datetimeProp(getDatetimeProp()) + .arrayNullableProp(getArrayNullableProp()) + .arrayAndItemsNullableProp(getArrayAndItemsNullableProp()) + .arrayItemsNullable(getArrayItemsNullable()) + .objectNullableProp(getObjectNullableProp()) + .objectAndItemsNullableProp(getObjectAndItemsNullableProp()) + .objectItemsNullable(getObjectItemsNullable()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java index 61f902621259..2e3e959e3fb2 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private NumberOnly instance; + + public Builder() { + this(new NumberOnly()); + } + + protected Builder(NumberOnly instance) { + this.instance = instance; + } + + public NumberOnly.Builder justNumber(BigDecimal justNumber) { + this.instance.justNumber = justNumber; + return this; + } + + + /** + * returns a built NumberOnly instance. + * + * The builder is not reusable. + */ + public NumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static NumberOnly.Builder builder() { + return new NumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NumberOnly.Builder toBuilder() { + return new NumberOnly.Builder() + .justNumber(getJustNumber()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index 1d59c1e8691a..d54efdc635b9 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -221,5 +221,74 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ObjectWithDeprecatedFields instance; + + public Builder() { + this(new ObjectWithDeprecatedFields()); + } + + protected Builder(ObjectWithDeprecatedFields instance) { + this.instance = instance; + } + + public ObjectWithDeprecatedFields.Builder uuid(String uuid) { + this.instance.uuid = uuid; + return this; + } + public ObjectWithDeprecatedFields.Builder id(BigDecimal id) { + this.instance.id = id; + return this; + } + public ObjectWithDeprecatedFields.Builder deprecatedRef(DeprecatedObject deprecatedRef) { + this.instance.deprecatedRef = deprecatedRef; + return this; + } + public ObjectWithDeprecatedFields.Builder bars(List bars) { + this.instance.bars = bars; + return this; + } + + + /** + * returns a built ObjectWithDeprecatedFields instance. + * + * The builder is not reusable. + */ + public ObjectWithDeprecatedFields build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ObjectWithDeprecatedFields.Builder builder() { + return new ObjectWithDeprecatedFields.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ObjectWithDeprecatedFields.Builder toBuilder() { + return new ObjectWithDeprecatedFields.Builder() + .uuid(getUuid()) + .id(getId()) + .deprecatedRef(getDeprecatedRef()) + .bars(getBars()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java index f09c51a69205..f2b329fb7f6e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java @@ -304,5 +304,84 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Order instance; + + public Builder() { + this(new Order()); + } + + protected Builder(Order instance) { + this.instance = instance; + } + + public Order.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Order.Builder petId(Long petId) { + this.instance.petId = petId; + return this; + } + public Order.Builder quantity(Integer quantity) { + this.instance.quantity = quantity; + return this; + } + public Order.Builder shipDate(OffsetDateTime shipDate) { + this.instance.shipDate = shipDate; + return this; + } + public Order.Builder status(StatusEnum status) { + this.instance.status = status; + return this; + } + public Order.Builder complete(Boolean complete) { + this.instance.complete = complete; + return this; + } + + + /** + * returns a built Order instance. + * + * The builder is not reusable. + */ + public Order build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Order.Builder builder() { + return new Order.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Order.Builder toBuilder() { + return new Order.Builder() + .id(getId()) + .petId(getPetId()) + .quantity(getQuantity()) + .shipDate(getShipDate()) + .status(getStatus()) + .complete(getComplete()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java index 200d1214cd18..1ec45f738551 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -171,5 +171,69 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private OuterComposite instance; + + public Builder() { + this(new OuterComposite()); + } + + protected Builder(OuterComposite instance) { + this.instance = instance; + } + + public OuterComposite.Builder myNumber(BigDecimal myNumber) { + this.instance.myNumber = myNumber; + return this; + } + public OuterComposite.Builder myString(String myString) { + this.instance.myString = myString; + return this; + } + public OuterComposite.Builder myBoolean(Boolean myBoolean) { + this.instance.myBoolean = myBoolean; + return this; + } + + + /** + * returns a built OuterComposite instance. + * + * The builder is not reusable. + */ + public OuterComposite build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static OuterComposite.Builder builder() { + return new OuterComposite.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OuterComposite.Builder toBuilder() { + return new OuterComposite.Builder() + .myNumber(getMyNumber()) + .myString(getMyString()) + .myBoolean(getMyBoolean()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java index 1e2b30c0fddb..215c7847f05e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private OuterObjectWithEnumProperty instance; + + public Builder() { + this(new OuterObjectWithEnumProperty()); + } + + protected Builder(OuterObjectWithEnumProperty instance) { + this.instance = instance; + } + + public OuterObjectWithEnumProperty.Builder value(OuterEnumInteger value) { + this.instance.value = value; + return this; + } + + + /** + * returns a built OuterObjectWithEnumProperty instance. + * + * The builder is not reusable. + */ + public OuterObjectWithEnumProperty build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static OuterObjectWithEnumProperty.Builder builder() { + return new OuterObjectWithEnumProperty.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OuterObjectWithEnumProperty.Builder toBuilder() { + return new OuterObjectWithEnumProperty.Builder() + .value(getValue()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ParentWithNullable.java index 2fff6a8b42bf..bfbb6ef68f0a 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -206,5 +206,68 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ParentWithNullable instance; + + public Builder() { + this(new ParentWithNullable()); + } + + protected Builder(ParentWithNullable instance) { + this.instance = instance; + } + + public ParentWithNullable.Builder type(TypeEnum type) { + this.instance.type = type; + return this; + } + public ParentWithNullable.Builder nullableProperty(String nullableProperty) { + this.instance.nullableProperty = JsonNullable.of(nullableProperty); + return this; + } + public ParentWithNullable.Builder nullableProperty(JsonNullable nullableProperty) { + this.instance.nullableProperty = nullableProperty; + return this; + } + + + /** + * returns a built ParentWithNullable instance. + * + * The builder is not reusable. + */ + public ParentWithNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ParentWithNullable.Builder builder() { + return new ParentWithNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ParentWithNullable.Builder toBuilder() { + return new ParentWithNullable.Builder() + .type(getType()) + .nullableProperty(getNullableProperty()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java index fbf2acd86286..45cae8bbb708 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java @@ -328,5 +328,84 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Pet instance; + + public Builder() { + this(new Pet()); + } + + protected Builder(Pet instance) { + this.instance = instance; + } + + public Pet.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Pet.Builder category(Category category) { + this.instance.category = category; + return this; + } + public Pet.Builder name(String name) { + this.instance.name = name; + return this; + } + public Pet.Builder photoUrls(Set photoUrls) { + this.instance.photoUrls = photoUrls; + return this; + } + public Pet.Builder tags(List tags) { + this.instance.tags = tags; + return this; + } + public Pet.Builder status(StatusEnum status) { + this.instance.status = status; + return this; + } + + + /** + * returns a built Pet instance. + * + * The builder is not reusable. + */ + public Pet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Pet.Builder builder() { + return new Pet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pet.Builder toBuilder() { + return new Pet.Builder() + .id(getId()) + .category(getCategory()) + .name(getName()) + .photoUrls(getPhotoUrls()) + .tags(getTags()) + .status(getStatus()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 1de9a07e2d71..82fb4f08242e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -137,5 +137,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ReadOnlyFirst instance; + + public Builder() { + this(new ReadOnlyFirst()); + } + + protected Builder(ReadOnlyFirst instance) { + this.instance = instance; + } + + public ReadOnlyFirst.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + public ReadOnlyFirst.Builder baz(String baz) { + this.instance.baz = baz; + return this; + } + + + /** + * returns a built ReadOnlyFirst instance. + * + * The builder is not reusable. + */ + public ReadOnlyFirst build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ReadOnlyFirst.Builder builder() { + return new ReadOnlyFirst.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ReadOnlyFirst.Builder toBuilder() { + return new ReadOnlyFirst.Builder() + .bar(getBar()) + .baz(getBaz()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java index 7de114855b65..2336813d7b36 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private SpecialModelName instance; + + public Builder() { + this(new SpecialModelName()); + } + + protected Builder(SpecialModelName instance) { + this.instance = instance; + } + + public SpecialModelName.Builder $specialPropertyName(Long $specialPropertyName) { + this.instance.$specialPropertyName = $specialPropertyName; + return this; + } + + + /** + * returns a built SpecialModelName instance. + * + * The builder is not reusable. + */ + public SpecialModelName build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static SpecialModelName.Builder builder() { + return new SpecialModelName.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public SpecialModelName.Builder toBuilder() { + return new SpecialModelName.Builder() + .$specialPropertyName(get$SpecialPropertyName()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java index 42a0ef4b78ad..e67b34efd42d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java @@ -138,5 +138,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Tag instance; + + public Builder() { + this(new Tag()); + } + + protected Builder(Tag instance) { + this.instance = instance; + } + + public Tag.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Tag.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built Tag instance. + * + * The builder is not reusable. + */ + public Tag build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Tag.Builder builder() { + return new Tag.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Tag.Builder toBuilder() { + return new Tag.Builder() + .id(getId()) + .name(getName()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index a7e74f88302a..4fb7a166add7 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -113,5 +113,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private TestInlineFreeformAdditionalPropertiesRequest instance; + + public Builder() { + this(new TestInlineFreeformAdditionalPropertiesRequest()); + } + + protected Builder(TestInlineFreeformAdditionalPropertiesRequest instance) { + this.instance = instance; + } + + public TestInlineFreeformAdditionalPropertiesRequest.Builder someProperty(String someProperty) { + this.instance.someProperty = someProperty; + return this; + } + + + /** + * returns a built TestInlineFreeformAdditionalPropertiesRequest instance. + * + * The builder is not reusable. + */ + public TestInlineFreeformAdditionalPropertiesRequest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static TestInlineFreeformAdditionalPropertiesRequest.Builder builder() { + return new TestInlineFreeformAdditionalPropertiesRequest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public TestInlineFreeformAdditionalPropertiesRequest.Builder toBuilder() { + return new TestInlineFreeformAdditionalPropertiesRequest.Builder() + .someProperty(getSomeProperty()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java index fa0855b56ee0..bccb32b21329 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java @@ -330,5 +330,94 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private User instance; + + public Builder() { + this(new User()); + } + + protected Builder(User instance) { + this.instance = instance; + } + + public User.Builder id(Long id) { + this.instance.id = id; + return this; + } + public User.Builder username(String username) { + this.instance.username = username; + return this; + } + public User.Builder firstName(String firstName) { + this.instance.firstName = firstName; + return this; + } + public User.Builder lastName(String lastName) { + this.instance.lastName = lastName; + return this; + } + public User.Builder email(String email) { + this.instance.email = email; + return this; + } + public User.Builder password(String password) { + this.instance.password = password; + return this; + } + public User.Builder phone(String phone) { + this.instance.phone = phone; + return this; + } + public User.Builder userStatus(Integer userStatus) { + this.instance.userStatus = userStatus; + return this; + } + + + /** + * returns a built User instance. + * + * The builder is not reusable. + */ + public User build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static User.Builder builder() { + return new User.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public User.Builder toBuilder() { + return new User.Builder() + .id(getId()) + .username(getUsername()) + .firstName(getFirstName()) + .lastName(getLastName()) + .email(getEmail()) + .password(getPassword()) + .phone(getPhone()) + .userStatus(getUserStatus()); + } + + } diff --git a/samples/client/petstore/javascript-es6/docs/HealthCheckResult.md b/samples/client/petstore/javascript-es6/docs/HealthCheckResult.md new file mode 100644 index 000000000000..bbb74ac6a0ae --- /dev/null +++ b/samples/client/petstore/javascript-es6/docs/HealthCheckResult.md @@ -0,0 +1,9 @@ +# OpenApiPetstore.HealthCheckResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + + diff --git a/samples/client/petstore/javascript-es6/src/model/HealthCheckResult.js b/samples/client/petstore/javascript-es6/src/model/HealthCheckResult.js new file mode 100644 index 000000000000..112fd7784265 --- /dev/null +++ b/samples/client/petstore/javascript-es6/src/model/HealthCheckResult.js @@ -0,0 +1,88 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The HealthCheckResult model module. + * @module model/HealthCheckResult + * @version 1.0.0 + */ +class HealthCheckResult { + /** + * Constructs a new HealthCheckResult. + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + * @alias module:model/HealthCheckResult + */ + constructor() { + + HealthCheckResult.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a HealthCheckResult from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/HealthCheckResult} obj Optional instance to populate. + * @return {module:model/HealthCheckResult} The populated HealthCheckResult instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new HealthCheckResult(); + + if (data.hasOwnProperty('NullableMessage')) { + obj['NullableMessage'] = ApiClient.convertToType(data['NullableMessage'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to HealthCheckResult. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to HealthCheckResult. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['NullableMessage'] && !(typeof data['NullableMessage'] === 'string' || data['NullableMessage'] instanceof String)) { + throw new Error("Expected the field `NullableMessage` to be a primitive type in the JSON string but got " + data['NullableMessage']); + } + + return true; + } + + +} + + + +/** + * @member {String} NullableMessage + */ +HealthCheckResult.prototype['NullableMessage'] = undefined; + + + + + + +export default HealthCheckResult; + diff --git a/samples/client/petstore/javascript-es6/test/model/HealthCheckResult.spec.js b/samples/client/petstore/javascript-es6/test/model/HealthCheckResult.spec.js new file mode 100644 index 000000000000..25d9ecd929f0 --- /dev/null +++ b/samples/client/petstore/javascript-es6/test/model/HealthCheckResult.spec.js @@ -0,0 +1,65 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.HealthCheckResult(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('HealthCheckResult', function() { + it('should create an instance of HealthCheckResult', function() { + // uncomment below and update the code to test HealthCheckResult + //var instance = new OpenApiPetstore.HealthCheckResult(); + //expect(instance).to.be.a(OpenApiPetstore.HealthCheckResult); + }); + + it('should have the property nullableMessage (base name: "NullableMessage")', function() { + // uncomment below and update the code to test the property nullableMessage + //var instance = new OpenApiPetstore.HealthCheckResult(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/julia/docs/AnotherModel.md b/samples/client/petstore/julia/docs/AnotherModel.md new file mode 100644 index 000000000000..3fc35e1b3606 --- /dev/null +++ b/samples/client/petstore/julia/docs/AnotherModel.md @@ -0,0 +1,13 @@ +# AnotherModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**another_property** | **Int64** | | [optional] [default to nothing] +**uuid_default_value** | **String** | | [optional] [default to nothing] + + +[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/julia/src/models/model_AnotherModel.jl b/samples/client/petstore/julia/src/models/model_AnotherModel.jl new file mode 100644 index 000000000000..e5235e2e4be0 --- /dev/null +++ b/samples/client/petstore/julia/src/models/model_AnotherModel.jl @@ -0,0 +1,41 @@ +# This file was generated by the Julia OpenAPI Code Generator +# Do not modify this file directly. Modify the OpenAPI specification instead. + + +@doc raw"""another_model +to test mapping features + + AnotherModel(; + another_property=nothing, + uuid_default_value=nothing, + ) + + - another_property::Int64 + - uuid_default_value::String +""" +Base.@kwdef mutable struct AnotherModel <: OpenAPI.APIModel + another_property::Union{Nothing, Int64} = nothing + uuid_default_value::Union{Nothing, String} = nothing + + function AnotherModel(another_property, uuid_default_value, ) + OpenAPI.validate_property(AnotherModel, Symbol("another_property"), another_property) + OpenAPI.validate_property(AnotherModel, Symbol("uuid_default_value"), uuid_default_value) + return new(another_property, uuid_default_value, ) + end +end # type AnotherModel + +const _property_types_AnotherModel = Dict{Symbol,String}(Symbol("another_property")=>"Int64", Symbol("uuid_default_value")=>"String", ) +OpenAPI.property_type(::Type{ AnotherModel }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_AnotherModel[name]))} + +function check_required(o::AnotherModel) + true +end + +function OpenAPI.validate_property(::Type{ AnotherModel }, name::Symbol, val) + if name === Symbol("another_property") + OpenAPI.validate_param(name, "AnotherModel", :format, val, "int32") + end + if name === Symbol("uuid_default_value") + OpenAPI.validate_param(name, "AnotherModel", :format, val, "uuid") + end +end diff --git a/samples/client/petstore/kotlin-allOff-discriminator/build.gradle b/samples/client/petstore/kotlin-allOff-discriminator/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-allOff-discriminator/build.gradle +++ b/samples/client/petstore/kotlin-allOff-discriminator/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-allOff-discriminator/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-allOff-discriminator/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-allOff-discriminator/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-allOff-discriminator/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-allOff-discriminator/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-allOff-discriminator/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-allOff-discriminator/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-allOff-discriminator/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/petstore/kotlin-allOff-discriminator/gradlew b/samples/client/petstore/kotlin-allOff-discriminator/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-allOff-discriminator/gradlew +++ b/samples/client/petstore/kotlin-allOff-discriminator/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/petstore/kotlin-allOff-discriminator/gradlew.bat b/samples/client/petstore/kotlin-allOff-discriminator/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-allOff-discriminator/gradlew.bat +++ b/samples/client/petstore/kotlin-allOff-discriminator/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/petstore/kotlin-allOff-discriminator/settings.gradle b/samples/client/petstore/kotlin-allOff-discriminator/settings.gradle index 2210adb73c3b..4c574dc69245 100644 --- a/samples/client/petstore/kotlin-allOff-discriminator/settings.gradle +++ b/samples/client/petstore/kotlin-allOff-discriminator/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-allOff-discriminator' diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/build.gradle b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/build.gradle +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/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/petstore/kotlin-array-simple-string-jvm-okhttp4/gradlew b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradlew +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/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/petstore/kotlin-array-simple-string-jvm-okhttp4/gradlew.bat b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/gradlew.bat +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/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/petstore/kotlin-array-simple-string-jvm-okhttp4/settings.gradle b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/settings.gradle index dd134a971e83..e2cc9f161bc0 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/settings.gradle +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-array-simple-string-jvm-okhttp4' diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/build.gradle b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/build.gradle index ccd5d4680c29..8474c5683e56 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/build.gradle +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/build.gradle @@ -1,7 +1,7 @@ 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" @@ -19,7 +19,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' } } diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..4b01038305d2 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/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-7.6.2-all.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradlew b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradlew +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/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/petstore/kotlin-array-simple-string-jvm-volley/gradlew.bat b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradlew.bat +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/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/petstore/kotlin-array-simple-string-jvm-volley/settings.gradle b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/settings.gradle index b96f0c03c0dc..eb08621c1eef 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/settings.gradle +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-array-simple-string-jvm-volley' diff --git a/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-array-simple-string-multiplatform/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/petstore/kotlin-array-simple-string-multiplatform/gradlew b/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradlew +++ b/samples/client/petstore/kotlin-array-simple-string-multiplatform/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/petstore/kotlin-array-simple-string-multiplatform/gradlew.bat b/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-array-simple-string-multiplatform/gradlew.bat +++ b/samples/client/petstore/kotlin-array-simple-string-multiplatform/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/petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/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/petstore/kotlin-bigdecimal-default-multiplatform/gradlew b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradlew +++ b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/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/petstore/kotlin-bigdecimal-default-multiplatform/gradlew.bat b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/gradlew.bat +++ b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/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/petstore/kotlin-bigdecimal-default-okhttp4/build.gradle b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/build.gradle +++ b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/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/petstore/kotlin-bigdecimal-default-okhttp4/gradlew b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradlew +++ b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/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/petstore/kotlin-bigdecimal-default-okhttp4/gradlew.bat b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/gradlew.bat +++ b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/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/petstore/kotlin-bigdecimal-default-okhttp4/settings.gradle b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/settings.gradle index c9a032f9adee..2713d8732337 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/settings.gradle +++ b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-bigdecimal-default-okhttp4' diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/build.gradle b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/build.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/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/petstore/kotlin-default-values-jvm-okhttp4/gradlew b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradlew +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/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/petstore/kotlin-default-values-jvm-okhttp4/gradlew.bat b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/gradlew.bat +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/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/petstore/kotlin-default-values-jvm-okhttp4/settings.gradle b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/settings.gradle index b924bf333a66..707b810f1245 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/settings.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-default-values-jvm-okhttp4' diff --git a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/build.gradle b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/build.gradle index 0460393fdfc4..94c16d7910e4 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/build.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/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.kotlin_version = '1.9.23' ext.retrofitVersion = '2.10.0' - // 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" } diff --git a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/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/petstore/kotlin-default-values-jvm-retrofit2/gradlew b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradlew +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/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/petstore/kotlin-default-values-jvm-retrofit2/gradlew.bat b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/gradlew.bat +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/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/petstore/kotlin-default-values-jvm-retrofit2/settings.gradle b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/settings.gradle index 910191f984e3..3ad98b937087 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/settings.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-default-values-jvm-retrofit2' diff --git a/samples/client/petstore/kotlin-default-values-jvm-volley/build.gradle b/samples/client/petstore/kotlin-default-values-jvm-volley/build.gradle index e1597d417fe5..ccbdf66f37ef 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-volley/build.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-volley/build.gradle @@ -1,7 +1,7 @@ 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" @@ -19,7 +19,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' } } diff --git a/samples/client/petstore/kotlin-default-values-jvm-volley/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-default-values-jvm-volley/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-default-values-jvm-volley/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-default-values-jvm-volley/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-default-values-jvm-volley/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-default-values-jvm-volley/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..4b01038305d2 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-volley/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-default-values-jvm-volley/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-7.6.2-all.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/kotlin-default-values-jvm-volley/gradlew b/samples/client/petstore/kotlin-default-values-jvm-volley/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-volley/gradlew +++ b/samples/client/petstore/kotlin-default-values-jvm-volley/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/petstore/kotlin-default-values-jvm-volley/gradlew.bat b/samples/client/petstore/kotlin-default-values-jvm-volley/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-volley/gradlew.bat +++ b/samples/client/petstore/kotlin-default-values-jvm-volley/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/petstore/kotlin-default-values-jvm-volley/settings.gradle b/samples/client/petstore/kotlin-default-values-jvm-volley/settings.gradle index a1abf3a74e06..5f9a81975fcb 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-volley/settings.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-volley/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-default-values-jvm-volley' diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-default-values-multiplatform/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-default-values-multiplatform/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-default-values-multiplatform/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-default-values-multiplatform/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-default-values-multiplatform/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/petstore/kotlin-default-values-multiplatform/gradlew b/samples/client/petstore/kotlin-default-values-multiplatform/gradlew index aeb74cbb43e3..9d0ce634cb11 100755 --- a/samples/client/petstore/kotlin-default-values-multiplatform/gradlew +++ b/samples/client/petstore/kotlin-default-values-multiplatform/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/petstore/kotlin-default-values-multiplatform/gradlew.bat b/samples/client/petstore/kotlin-default-values-multiplatform/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/gradlew.bat +++ b/samples/client/petstore/kotlin-default-values-multiplatform/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/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt new file mode 100644 index 000000000000..3e5ce541214c --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -0,0 +1,132 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.apis + + +import org.openapitools.client.infrastructure.* +import io.ktor.client.HttpClient +import io.ktor.client.HttpClientConfig +import io.ktor.client.request.forms.formData +import io.ktor.client.engine.HttpClientEngine +import kotlinx.serialization.json.Json +import io.ktor.http.ParametersBuilder +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* + +open class DefaultApi : ApiClient { + + constructor( + baseUrl: String = ApiClient.BASE_URL, + httpClientEngine: HttpClientEngine? = null, + httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null, + jsonSerializer: Json = ApiClient.JSON_DEFAULT + ) : super(baseUrl = baseUrl, httpClientEngine = httpClientEngine, httpClientConfig = httpClientConfig, jsonBlock = jsonSerializer) + + constructor( + baseUrl: String, + httpClient: HttpClient + ): super(baseUrl = baseUrl, httpClient = httpClient) + + /** + * Tests default values + * Tests default values of different parameters + * @param pi0 (default to 10) + * @param pi1 + * @param pn0 (default to 10.0) + * @param pn1 + * @param qi0 (optional, default to 10) + * @param qi1 (default to 71) + * @param qi2 (optional) + * @param qi3 + * @param qn0 (optional, default to 10.0) + * @param qn1 (default to 71.0) + * @param qn2 (optional) + * @param qn3 + * @param hi0 (optional, default to 10) + * @param hi1 (default to 71) + * @param hi2 (optional) + * @param hi3 + * @param hn0 (optional, default to 10.0) + * @param hn1 (default to 71.0) + * @param hn2 (optional) + * @param hn3 + * @param fi0 (optional, default to 10) + * @param fi1 (default to 71) + * @param fi2 (optional) + * @param fi3 + * @param fn0 (optional, default to 10.0) + * @param fn1 (default to 71.0) + * @param fn2 (optional) + * @param fn3 + * @param fn4 + * @return void + */ + open suspend fun test(pi0: kotlin.Int = 10, pi1: kotlin.Int, pn0: kotlin.Double = 10.0.toDouble(), pn1: kotlin.Double, qi0: kotlin.Int? = 10, qi1: kotlin.Int = 71, qi2: kotlin.Int? = null, qi3: kotlin.Int, qn0: kotlin.Double? = 10.0.toDouble(), qn1: kotlin.Double = 71.0.toDouble(), qn2: kotlin.Double? = null, qn3: kotlin.Double, hi0: kotlin.Int? = 10, hi1: kotlin.Int = 71, hi2: kotlin.Int? = null, hi3: kotlin.Int, hn0: kotlin.Double? = 10.0.toDouble(), hn1: kotlin.Double = 71.0.toDouble(), hn2: kotlin.Double? = null, hn3: kotlin.Double, fi0: kotlin.Int? = 10, fi1: kotlin.Int = 71, fi2: kotlin.Int? = null, fi3: kotlin.Int, fn0: kotlin.Double? = 10.0.toDouble(), fn1: kotlin.Double = 71.0.toDouble(), fn2: kotlin.Double? = null, fn3: kotlin.Double, fn4: kotlin.collections.List): HttpResponse { + + val localVariableAuthNames = listOf() + + val localVariableBody = + formData { + fi0?.apply { append("fi0", fi0) } + fi1?.apply { append("fi1", fi1) } + fi2?.apply { append("fi2", fi2) } + fi3?.apply { append("fi3", fi3) } + fn0?.apply { append("fn0", fn0) } + fn1?.apply { append("fn1", fn1) } + fn2?.apply { append("fn2", fn2) } + fn3?.apply { append("fn3", fn3) } + fn4?.onEach { + append("fn4[]", it) + } + } + + val localVariableQuery = mutableMapOf>() + qi0?.apply { localVariableQuery["qi0"] = listOf("$qi0") } + qi1?.apply { localVariableQuery["qi1"] = listOf("$qi1") } + qi2?.apply { localVariableQuery["qi2"] = listOf("$qi2") } + qi3?.apply { localVariableQuery["qi3"] = listOf("$qi3") } + qn0?.apply { localVariableQuery["qn0"] = listOf("$qn0") } + qn1?.apply { localVariableQuery["qn1"] = listOf("$qn1") } + qn2?.apply { localVariableQuery["qn2"] = listOf("$qn2") } + qn3?.apply { localVariableQuery["qn3"] = listOf("$qn3") } + val localVariableHeaders = mutableMapOf() + hi0?.apply { localVariableHeaders["hi0"] = this.toString() } + hi1?.apply { localVariableHeaders["hi1"] = this.toString() } + hi2?.apply { localVariableHeaders["hi2"] = this.toString() } + hi3?.apply { localVariableHeaders["hi3"] = this.toString() } + hn0?.apply { localVariableHeaders["hn0"] = this.toString() } + hn1?.apply { localVariableHeaders["hn1"] = this.toString() } + hn2?.apply { localVariableHeaders["hn2"] = this.toString() } + hn3?.apply { localVariableHeaders["hn3"] = this.toString() } + + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/test".replace("{" + "pi0" + "}", "$pi0").replace("{" + "pi1" + "}", "$pi1").replace("{" + "pn0" + "}", "$pn0").replace("{" + "pn1" + "}", "$pn1"), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + ) + + return multipartFormRequest( + localVariableConfig, + localVariableBody, + localVariableAuthNames + ).wrap() + } + + +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt new file mode 100644 index 000000000000..8bd8b59a8f82 --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt @@ -0,0 +1,16 @@ +package org.openapitools.client.auth + +class ApiKeyAuth(private val location: String, val paramName: String) : Authentication { + var apiKey: String? = null + var apiKeyPrefix: String? = null + + override fun apply(query: MutableMap>, headers: MutableMap) { + val key: String = apiKey ?: return + val prefix: String? = apiKeyPrefix + val value: String = if (prefix != null) "$prefix $key" else key + when (location) { + "query" -> query[paramName] = listOf(value) + "header" -> headers[paramName] = value + } + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/Authentication.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/Authentication.kt new file mode 100644 index 000000000000..2c5dfb4acc56 --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/Authentication.kt @@ -0,0 +1,13 @@ +package org.openapitools.client.auth + +interface Authentication { + + /** + * Apply authentication settings to header and query params. + * + * @param query Query parameters. + * @param headers Header parameters. + */ + fun apply(query: MutableMap>, headers: MutableMap) + +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt new file mode 100644 index 000000000000..40276dbb985e --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.auth + +import io.ktor.util.InternalAPI +import io.ktor.util.encodeBase64 + +class HttpBasicAuth : Authentication { + var username: String? = null + var password: String? = null + + @OptIn(InternalAPI::class) + override fun apply(query: MutableMap>, headers: MutableMap) { + if (username == null && password == null) return + val str = (username ?: "") + ":" + (password ?: "") + val auth = str.encodeBase64() + headers["Authorization"] = "Basic $auth" + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt new file mode 100644 index 000000000000..a6fb285af5c3 --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt @@ -0,0 +1,14 @@ +package org.openapitools.client.auth + +class HttpBearerAuth(private val scheme: String?) : Authentication { + var bearerToken: String? = null + + override fun apply(query: MutableMap>, headers: MutableMap) { + val token: String = bearerToken ?: return + headers["Authorization"] = (if (scheme != null) upperCaseBearer(scheme)!! + " " else "") + token + } + + private fun upperCaseBearer(scheme: String): String? { + return if ("bearer".equals(scheme, ignoreCase = true)) "Bearer" else scheme + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/OAuth.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/OAuth.kt new file mode 100644 index 000000000000..0e8f30f39383 --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/auth/OAuth.kt @@ -0,0 +1,10 @@ +package org.openapitools.client.auth + +class OAuth : Authentication { + var accessToken: String? = null + + override fun apply(query: MutableMap>, headers: MutableMap) { + val token: String = accessToken ?: return + headers["Authorization"] = "Bearer $token" + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt new file mode 100644 index 000000000000..a4a4491eac0d --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +typealias MultiValueMap = MutableMap> + +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipe" -> "|" + "space" -> " " + else -> "" +} + +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } + +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) + = toMultiValue(items.asIterable(), collectionFormat, map) + +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { + return when(collectionFormat) { + "multi" -> items.map(map) + else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt new file mode 100644 index 000000000000..70d03d97b87e --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -0,0 +1,183 @@ +package org.openapitools.client.infrastructure + +import io.ktor.client.HttpClient +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngine +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.client.request.* +import io.ktor.client.request.forms.FormDataContent +import io.ktor.client.request.forms.MultiPartFormDataContent +import io.ktor.client.request.header +import io.ktor.client.request.parameter +import io.ktor.client.statement.HttpResponse +import io.ktor.serialization.kotlinx.json.json +import io.ktor.http.* +import io.ktor.http.content.PartData +import kotlin.Unit +import kotlinx.serialization.json.Json + +import org.openapitools.client.auth.* + +open class ApiClient( + private val baseUrl: String +) { + + private lateinit var client: HttpClient + + constructor( + baseUrl: String, + httpClientEngine: HttpClientEngine?, + httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null, + jsonBlock: Json, + ) : this(baseUrl = baseUrl) { + val clientConfig: (HttpClientConfig<*>) -> Unit by lazy { + { + it.install(ContentNegotiation) { json(jsonBlock) } + httpClientConfig?.invoke(it) + } + } + + client = httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) + } + + constructor( + baseUrl: String, + httpClient: HttpClient + ): this(baseUrl = baseUrl) { + this.client = httpClient + } + + private val authentications: kotlin.collections.Map? = null + + companion object { + const val BASE_URL = "http://localhost" + val JSON_DEFAULT = Json { + ignoreUnknownKeys = true + prettyPrint = true + isLenient = true + } + protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) + } + + /** + * Set the username for the first HTTP basic authentication. + * + * @param username Username + */ + fun setUsername(username: String) { + val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? + ?: throw Exception("No HTTP basic authentication configured") + auth.username = username + } + + /** + * Set the password for the first HTTP basic authentication. + * + * @param password Password + */ + fun setPassword(password: String) { + val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? + ?: throw Exception("No HTTP basic authentication configured") + auth.password = password + } + + /** + * Set the API key value for the first API key authentication. + * + * @param apiKey API key + * @param paramName The name of the API key parameter, or null or set the first key. + */ + fun setApiKey(apiKey: String, paramName: String? = null) { + val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth? + ?: throw Exception("No API key authentication configured") + auth.apiKey = apiKey + } + + /** + * Set the API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + * @param paramName The name of the API key parameter, or null or set the first key. + */ + fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) { + val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth? + ?: throw Exception("No API key authentication configured") + auth.apiKeyPrefix = apiKeyPrefix + } + + /** + * Set the access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + fun setAccessToken(accessToken: String) { + val auth = authentications?.values?.firstOrNull { it is OAuth } as OAuth? + ?: throw Exception("No OAuth2 authentication configured") + auth.accessToken = accessToken + } + + /** + * Set the access token for the first Bearer authentication. + * + * @param bearerToken The bearer token. + */ + fun setBearerToken(bearerToken: String) { + val auth = authentications?.values?.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth? + ?: throw Exception("No Bearer authentication configured") + auth.bearerToken = bearerToken + } + + protected suspend fun multipartFormRequest(requestConfig: RequestConfig, body: kotlin.collections.List?, authNames: kotlin.collections.List): HttpResponse { + return request(requestConfig, MultiPartFormDataContent(body ?: listOf()), authNames) + } + + protected suspend fun urlEncodedFormRequest(requestConfig: RequestConfig, body: Parameters?, authNames: kotlin.collections.List): HttpResponse { + return request(requestConfig, FormDataContent(body ?: Parameters.Empty), authNames) + } + + protected suspend fun jsonRequest(requestConfig: RequestConfig, body: Any? = null, authNames: kotlin.collections.List): HttpResponse = request(requestConfig, body, authNames) + + protected suspend fun request(requestConfig: RequestConfig, body: Any? = null, authNames: kotlin.collections.List): HttpResponse { + requestConfig.updateForAuth(authNames) + val headers = requestConfig.headers + + return client.request { + this.url { + this.takeFrom(URLBuilder(baseUrl)) + appendPath(requestConfig.path.trimStart('/').split('/')) + requestConfig.query.forEach { query -> + query.value.forEach { value -> + parameter(query.key, value) + } + } + } + this.method = requestConfig.method.httpMethod + headers.filter { header -> !UNSAFE_HEADERS.contains(header.key) }.forEach { header -> this.header(header.key, header.value) } + if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH)) { + this.setBody(body) + } + } + } + + private fun RequestConfig.updateForAuth(authNames: kotlin.collections.List) { + for (authName in authNames) { + val auth = authentications?.get(authName) ?: throw Exception("Authentication undefined: $authName") + auth.apply(query, headers) + } + } + + private fun URLBuilder.appendPath(components: kotlin.collections.List): URLBuilder = apply { + encodedPath = encodedPath.trimEnd('/') + components.joinToString("/", prefix = "/") { it.encodeURLQueryComponent() } + } + + private val RequestMethod.httpMethod: HttpMethod + get() = when (this) { + RequestMethod.DELETE -> HttpMethod.Delete + RequestMethod.GET -> HttpMethod.Get + RequestMethod.HEAD -> HttpMethod.Head + RequestMethod.PATCH -> HttpMethod.Patch + RequestMethod.PUT -> HttpMethod.Put + RequestMethod.POST -> HttpMethod.Post + RequestMethod.OPTIONS -> HttpMethod.Options + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt new file mode 100644 index 000000000000..5aeea0894894 --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt @@ -0,0 +1,30 @@ +package org.openapitools.client.infrastructure + +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* + +@Serializable +class Base64ByteArray(val value: ByteArray) { + @Serializer(Base64ByteArray::class) + companion object : KSerializer { + override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) + override fun deserialize(decoder: Decoder) = Base64ByteArray(decoder.decodeString().decodeBase64Bytes()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + other as Base64ByteArray + return value.contentEquals(other.value) + } + + override fun hashCode(): Int { + return value.contentHashCode() + } + + override fun toString(): String { + return "Base64ByteArray(${hex(value)})" + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/Bytes.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/Bytes.kt new file mode 100644 index 000000000000..af8caa633ccb --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/Bytes.kt @@ -0,0 +1,100 @@ +package org.openapitools.client.infrastructure + +import io.ktor.utils.io.core.* +import kotlin.experimental.and + +private val digits = "0123456789abcdef".toCharArray() +private const val BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" +private const val BASE64_MASK: Byte = 0x3f +private const val BASE64_PAD = '=' +private val BASE64_INVERSE_ALPHABET = IntArray(256) { BASE64_ALPHABET.indexOf(it.toChar()) } + +private fun String.toCharArray(): CharArray = CharArray(length) { get(it) } +private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it] = 0 } +private fun Int.toBase64(): Char = BASE64_ALPHABET[this] +private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK +internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64() +internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes() + +/** + * Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes. + * + * Taken from https://github.com/ktorio/ktor/blob/master/ktor-utils/common/src/io/ktor/util/Crypto.kt + */ +internal fun hex(bytes: ByteArray): String { + val result = CharArray(bytes.size * 2) + var resultIndex = 0 + val digits = digits + + for (element in bytes) { + val b = element.toInt() and 0xff + result[resultIndex++] = digits[b shr 4] + result[resultIndex++] = digits[b and 0x0f] + } + + return result.concatToString() +} + +/** + * Decode bytes from HEX string. It should be no spaces and `0x` prefixes. + * + * Taken from https://github.com/ktorio/ktor/blob/master/ktor-utils/common/src/io/ktor/util/Crypto.kt + */ +internal fun hex(s: String): ByteArray { + val result = ByteArray(s.length / 2) + for (idx in result.indices) { + val srcIdx = idx * 2 + val high = s[srcIdx].toString().toInt(16) shl 4 + val low = s[srcIdx + 1].toString().toInt(16) + result[idx] = (high or low).toByte() + } + + return result +} + +/** + * Encode [ByteReadPacket] in base64 format. + * + * Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt + */ +private fun ByteReadPacket.encodeBase64(): String = buildString { + val data = ByteArray(3) + while (remaining > 0) { + val read = readAvailable(data) + data.clearFrom(read) + + val padSize = (data.size - read) * 8 / 6 + val chunk = ((data[0].toInt() and 0xFF) shl 16) or + ((data[1].toInt() and 0xFF) shl 8) or + (data[2].toInt() and 0xFF) + + for (index in data.size downTo padSize) { + val char = (chunk shr (6 * index)) and BASE64_MASK.toInt() + append(char.toBase64()) + } + + repeat(padSize) { append(BASE64_PAD) } + } +} + +/** + * Decode [ByteReadPacket] from base64 format + * + * Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt + */ +private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket { + val data = ByteArray(4) + + while (remaining > 0) { + val read = readAvailable(data) + + val chunk = data.foldIndexed(0) { index, result, current -> + result or (current.fromBase64().toInt() shl ((3 - index) * 6)) + } + + for (index in data.size - 2 downTo (data.size - read)) { + val origin = (chunk shr (8 * index)) and 0xff + writeByte(origin.toByte()) + } + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt new file mode 100644 index 000000000000..4285d605ea62 --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt @@ -0,0 +1,51 @@ +package org.openapitools.client.infrastructure + +import io.ktor.http.Headers +import io.ktor.http.isSuccess +import io.ktor.util.reflect.TypeInfo +import io.ktor.util.reflect.typeInfo + +open class HttpResponse(val response: io.ktor.client.statement.HttpResponse, val provider: BodyProvider) { + val status: Int = response.status.value + val success: Boolean = response.status.isSuccess() + val headers: Map> = response.headers.mapEntries() + suspend fun body(): T = provider.body(response) + suspend fun typedBody(type: TypeInfo): V = provider.typedBody(response, type) + + companion object { + private fun Headers.mapEntries(): Map> { + val result = mutableMapOf>() + entries().forEach { result[it.key] = it.value } + return result + } + } +} + +interface BodyProvider { + suspend fun body(response: io.ktor.client.statement.HttpResponse): T + suspend fun typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V +} + +class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { + @Suppress("UNCHECKED_CAST") + override suspend fun body(response: io.ktor.client.statement.HttpResponse): T = + response.call.body(type) as T + + @Suppress("UNCHECKED_CAST") + override suspend fun typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V = + response.call.body(type) as V +} + +class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { + override suspend fun body(response: io.ktor.client.statement.HttpResponse): T = + block(provider.body(response)) + + override suspend fun typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V = + provider.typedBody(response, type) +} + +inline fun io.ktor.client.statement.HttpResponse.wrap(): HttpResponse = + HttpResponse(this, TypedBodyProvider(typeInfo())) + +fun HttpResponse.map(block: T.() -> V): HttpResponse = + HttpResponse(response, MappedBodyProvider(provider, block)) diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt new file mode 100644 index 000000000000..d10d7c506523 --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt @@ -0,0 +1,30 @@ +package org.openapitools.client.infrastructure + +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* + +@Serializable +class OctetByteArray(val value: ByteArray) { + @Serializer(OctetByteArray::class) + companion object : KSerializer { + override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value)) + override fun deserialize(decoder: Decoder) = OctetByteArray(hex(decoder.decodeString())) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + other as OctetByteArray + return value.contentEquals(other.value) + } + + override fun hashCode(): Int { + return value.contentHashCode() + } + + override fun toString(): String { + return "OctetByteArray(${hex(value)})" + } +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 000000000000..be00e38fbaee --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt new file mode 100644 index 000000000000..c3518a2d173c --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -0,0 +1,18 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given request. + * NOTE: This object doesn't include 'body' because it + * allows for caching of the constructed object + * for many request definitions. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: MutableMap = mutableMapOf(), + val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, + val body: T? = null +) diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt new file mode 100644 index 000000000000..beb56f07cdde --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -0,0 +1,8 @@ +package org.openapitools.client.infrastructure + +/** + * Provides enumerated HTTP verbs + */ +enum class RequestMethod { + GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT +} diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/models/Apa.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/models/Apa.kt new file mode 100644 index 000000000000..339fa40ec1b1 --- /dev/null +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/main/kotlin/org/openapitools/client/models/Apa.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* + +/** + * + * + * @param i0 + * @param n0 + * @param i1 + * @param n1 + */ +@Serializable + +data class Apa ( + + @SerialName(value = "i0") @Required val i0: kotlin.Int, + + @SerialName(value = "n0") @Required val n0: kotlin.Double, + + @SerialName(value = "i1") val i1: kotlin.Int? = null, + + @SerialName(value = "n1") val n1: kotlin.Double? = null + +) + diff --git a/samples/client/petstore/kotlin-enum-default-value/build.gradle b/samples/client/petstore/kotlin-enum-default-value/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-enum-default-value/build.gradle +++ b/samples/client/petstore/kotlin-enum-default-value/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-enum-default-value/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-enum-default-value/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/petstore/kotlin-enum-default-value/gradlew b/samples/client/petstore/kotlin-enum-default-value/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-enum-default-value/gradlew +++ b/samples/client/petstore/kotlin-enum-default-value/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/petstore/kotlin-enum-default-value/gradlew.bat b/samples/client/petstore/kotlin-enum-default-value/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-enum-default-value/gradlew.bat +++ b/samples/client/petstore/kotlin-enum-default-value/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/petstore/kotlin-enum-default-value/settings.gradle b/samples/client/petstore/kotlin-enum-default-value/settings.gradle index c52ee030424f..a0f6905b4bf7 100644 --- a/samples/client/petstore/kotlin-enum-default-value/settings.gradle +++ b/samples/client/petstore/kotlin-enum-default-value/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-enum-default-value' diff --git a/samples/client/petstore/kotlin-gson/build.gradle b/samples/client/petstore/kotlin-gson/build.gradle index 7c93f2774a13..ed4098e13738 100644 --- a/samples/client/petstore/kotlin-gson/build.gradle +++ b/samples/client/petstore/kotlin-gson/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-gson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-gson/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-gson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-gson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-gson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-gson/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-gson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-gson/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/petstore/kotlin-gson/gradlew b/samples/client/petstore/kotlin-gson/gradlew index aeb74cbb43e3..9d0ce634cb11 100755 --- a/samples/client/petstore/kotlin-gson/gradlew +++ b/samples/client/petstore/kotlin-gson/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/petstore/kotlin-gson/gradlew.bat b/samples/client/petstore/kotlin-gson/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-gson/gradlew.bat +++ b/samples/client/petstore/kotlin-gson/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/petstore/kotlin-gson/settings.gradle b/samples/client/petstore/kotlin-gson/settings.gradle index 36ee7cb153f7..a36725d2cb61 100644 --- a/samples/client/petstore/kotlin-gson/settings.gradle +++ b/samples/client/petstore/kotlin-gson/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-gson' diff --git a/samples/client/petstore/kotlin-jackson/build.gradle b/samples/client/petstore/kotlin-jackson/build.gradle index 2ac5000f7bf1..13cac8bc447d 100644 --- a/samples/client/petstore/kotlin-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jackson/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-jackson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jackson/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jackson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jackson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jackson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jackson/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jackson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jackson/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/petstore/kotlin-jackson/gradlew b/samples/client/petstore/kotlin-jackson/gradlew index aeb74cbb43e3..9d0ce634cb11 100755 --- a/samples/client/petstore/kotlin-jackson/gradlew +++ b/samples/client/petstore/kotlin-jackson/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/petstore/kotlin-jackson/gradlew.bat b/samples/client/petstore/kotlin-jackson/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jackson/gradlew.bat +++ b/samples/client/petstore/kotlin-jackson/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/petstore/kotlin-jackson/settings.gradle b/samples/client/petstore/kotlin-jackson/settings.gradle index cda75f599e8b..ef91c4caa687 100644 --- a/samples/client/petstore/kotlin-jackson/settings.gradle +++ b/samples/client/petstore/kotlin-jackson/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jackson' diff --git a/samples/client/petstore/kotlin-json-request-string/build.gradle b/samples/client/petstore/kotlin-json-request-string/build.gradle index 719b51b142b0..821fd5bfdc34 100644 --- a/samples/client/petstore/kotlin-json-request-string/build.gradle +++ b/samples/client/petstore/kotlin-json-request-string/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-json-request-string/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-json-request-string/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-json-request-string/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-json-request-string/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-json-request-string/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-json-request-string/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-json-request-string/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-json-request-string/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/petstore/kotlin-json-request-string/gradlew b/samples/client/petstore/kotlin-json-request-string/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-json-request-string/gradlew +++ b/samples/client/petstore/kotlin-json-request-string/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/petstore/kotlin-json-request-string/gradlew.bat b/samples/client/petstore/kotlin-json-request-string/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-json-request-string/gradlew.bat +++ b/samples/client/petstore/kotlin-json-request-string/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/petstore/kotlin-json-request-string/settings.gradle b/samples/client/petstore/kotlin-json-request-string/settings.gradle index 384b256a8176..dedd56bdccd0 100644 --- a/samples/client/petstore/kotlin-json-request-string/settings.gradle +++ b/samples/client/petstore/kotlin-json-request-string/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-json-request-string' diff --git a/samples/client/petstore/kotlin-jvm-jackson/build.gradle b/samples/client/petstore/kotlin-jvm-jackson/build.gradle index 79ca18b68f6c..ad7aa14b2af3 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-jackson/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.kotlin_version = '1.9.23' ext.retrofitVersion = '2.10.0' - // 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" } diff --git a/samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-jackson/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/petstore/kotlin-jvm-jackson/gradlew b/samples/client/petstore/kotlin-jvm-jackson/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/gradlew +++ b/samples/client/petstore/kotlin-jvm-jackson/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/petstore/kotlin-jvm-jackson/gradlew.bat b/samples/client/petstore/kotlin-jvm-jackson/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-jackson/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/petstore/kotlin-jvm-jackson/settings.gradle b/samples/client/petstore/kotlin-jvm-jackson/settings.gradle index bf58268be5f0..eb4136f80d13 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-jackson/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-jackson' diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/build.gradle b/samples/client/petstore/kotlin-jvm-ktor-gson/build.gradle index 4409d7f200e9..21819e84790c 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/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.kotlin_version = '1.9.23' ext.ktor_version = '2.3.9' - // 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" } diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-ktor-gson/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-ktor-gson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-ktor-gson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-ktor-gson/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/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/petstore/kotlin-jvm-ktor-gson/gradlew b/samples/client/petstore/kotlin-jvm-ktor-gson/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/gradlew +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/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/petstore/kotlin-jvm-ktor-gson/gradlew.bat b/samples/client/petstore/kotlin-jvm-ktor-gson/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/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/petstore/kotlin-jvm-ktor-gson/settings.gradle b/samples/client/petstore/kotlin-jvm-ktor-gson/settings.gradle index 94597111ee8a..17883546e2e9 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-ktor-gson' diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/build.gradle b/samples/client/petstore/kotlin-jvm-ktor-jackson/build.gradle index eed298966bce..02e7419ed595 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/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.kotlin_version = '1.9.23' ext.ktor_version = '2.3.9' - // 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" } diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-ktor-jackson/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-ktor-jackson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-ktor-jackson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-ktor-jackson/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/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/petstore/kotlin-jvm-ktor-jackson/gradlew b/samples/client/petstore/kotlin-jvm-ktor-jackson/gradlew index aeb74cbb43e3..9d0ce634cb11 100755 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/gradlew +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/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/petstore/kotlin-jvm-ktor-jackson/gradlew.bat b/samples/client/petstore/kotlin-jvm-ktor-jackson/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/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/petstore/kotlin-jvm-ktor-jackson/settings.gradle b/samples/client/petstore/kotlin-jvm-ktor-jackson/settings.gradle index 4253fe68194c..3160b58d6f98 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-ktor-jackson' diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/build.gradle b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/build.gradle index bc9239e129c9..126b859fb7b1 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/build.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/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.kotlin_version = '1.9.23' ext.ktor_version = '2.3.9' - // 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" } diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/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/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradlew b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradlew +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/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/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradlew.bat b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/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/petstore/kotlin-jvm-ktor-kotlinx_serialization/settings.gradle b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/settings.gradle index 58699853396c..b6e26153f0ec 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-ktor-kotlinx_serialization' diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle index c6c3de9957f7..05954224125f 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/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/petstore/kotlin-jvm-okhttp4-coroutines/gradlew b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradlew +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/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/petstore/kotlin-jvm-okhttp4-coroutines/gradlew.bat b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/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/petstore/kotlin-jvm-okhttp4-coroutines/settings.gradle b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/settings.gradle index 7d37a50279f4..47dee9b11801 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-okhttp4-coroutines-client' diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/build.gradle b/samples/client/petstore/kotlin-jvm-spring-2-webclient/build.gradle index 76eb16802b97..06cdabfd2e56 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/build.gradle +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/build.gradle @@ -2,16 +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.kotlin_version = '1.9.23' ext.spring_boot_version = "2.7.18" - ext.reactor_version = "3.6.4" - // 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" } @@ -61,6 +59,6 @@ dependencies { 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-webflux:$spring_boot_version" - implementation "io.projectreactor:reactor-core:$reactor_version" + implementation "io.projectreactor:reactor-core:3.6.5" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-spring-2-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/petstore/kotlin-jvm-spring-2-webclient/gradlew b/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradlew +++ b/samples/client/petstore/kotlin-jvm-spring-2-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/petstore/kotlin-jvm-spring-2-webclient/gradlew.bat b/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-spring-2-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/petstore/kotlin-jvm-spring-2-webclient/settings.gradle b/samples/client/petstore/kotlin-jvm-spring-2-webclient/settings.gradle index f87f6dfa1468..81234fc57f2d 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-spring-webclient' diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/build.gradle b/samples/client/petstore/kotlin-jvm-spring-3-restclient/build.gradle index 2e7658f2f33d..2fc16aeeb5c6 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/build.gradle +++ b/samples/client/petstore/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/petstore/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/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/petstore/kotlin-jvm-spring-3-restclient/gradlew b/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradlew +++ b/samples/client/petstore/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/petstore/kotlin-jvm-spring-3-restclient/gradlew.bat b/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/gradlew.bat +++ b/samples/client/petstore/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/petstore/kotlin-jvm-spring-3-restclient/settings.gradle b/samples/client/petstore/kotlin-jvm-spring-3-restclient/settings.gradle index df5429b3bbef..ff7d6487a279 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-spring-restclient' diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a1555520b2c6..4f5441e98e59 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -77,7 +77,7 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null): Unit { - val result = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) + deletePetWithHttpInfo(petId = petId, apiKey = apiKey) } @Throws(RestClientResponseException::class) @@ -273,7 +273,7 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): Unit { - val result = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) + updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) } @Throws(RestClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e16a15939444..777a6f9f5e4e 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -39,7 +39,7 @@ class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deleteOrder(orderId: kotlin.String): Unit { - val result = deleteOrderWithHttpInfo(orderId = orderId) + deleteOrderWithHttpInfo(orderId = orderId) } @Throws(RestClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index caa0f6729b69..8d7967a0d707 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -39,7 +39,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUser(user: User): Unit { - val result = createUserWithHttpInfo(user = user) + createUserWithHttpInfo(user = user) } @Throws(RestClientResponseException::class) @@ -73,7 +73,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUsersWithArrayInput(user: kotlin.collections.List): Unit { - val result = createUsersWithArrayInputWithHttpInfo(user = user) + createUsersWithArrayInputWithHttpInfo(user = user) } @Throws(RestClientResponseException::class) @@ -107,7 +107,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUsersWithListInput(user: kotlin.collections.List): Unit { - val result = createUsersWithListInputWithHttpInfo(user = user) + createUsersWithListInputWithHttpInfo(user = user) } @Throws(RestClientResponseException::class) @@ -141,7 +141,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deleteUser(username: kotlin.String): Unit { - val result = deleteUserWithHttpInfo(username = username) + deleteUserWithHttpInfo(username = username) } @Throws(RestClientResponseException::class) @@ -250,7 +250,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun logoutUser(): Unit { - val result = logoutUserWithHttpInfo() + logoutUserWithHttpInfo() } @Throws(RestClientResponseException::class) @@ -283,7 +283,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updateUser(username: kotlin.String, user: User): Unit { - val result = updateUserWithHttpInfo(username = username, user = user) + updateUserWithHttpInfo(username = username, user = user) } @Throws(RestClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/build.gradle b/samples/client/petstore/kotlin-jvm-spring-3-webclient/build.gradle index 81441fc10fa6..99192219a9d1 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/build.gradle +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/build.gradle @@ -2,16 +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" - ext.reactor_version = "3.6.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" } @@ -67,6 +65,6 @@ dependencies { 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-webflux:$spring_boot_version" - implementation "io.projectreactor:reactor-core:$reactor_version" + implementation "io.projectreactor:reactor-core:3.6.5" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/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/petstore/kotlin-jvm-spring-3-webclient/gradlew b/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradlew +++ b/samples/client/petstore/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/petstore/kotlin-jvm-spring-3-webclient/gradlew.bat b/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/gradlew.bat +++ b/samples/client/petstore/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/petstore/kotlin-jvm-spring-3-webclient/settings.gradle b/samples/client/petstore/kotlin-jvm-spring-3-webclient/settings.gradle index f87f6dfa1468..81234fc57f2d 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-spring-webclient' diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/build.gradle b/samples/client/petstore/kotlin-jvm-vertx-gson/build.gradle index 75b60d0fae25..b905eef5d547 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/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.kotlin_version = '1.9.23' ext.vertx_version = "4.5.6" - // 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" } diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-vertx-gson/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-vertx-gson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-vertx-gson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-vertx-gson/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/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/petstore/kotlin-jvm-vertx-gson/gradlew b/samples/client/petstore/kotlin-jvm-vertx-gson/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/gradlew +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/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/petstore/kotlin-jvm-vertx-gson/gradlew.bat b/samples/client/petstore/kotlin-jvm-vertx-gson/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/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/petstore/kotlin-jvm-vertx-gson/settings.gradle b/samples/client/petstore/kotlin-jvm-vertx-gson/settings.gradle index d8a62b9a59b2..956ff72ba57f 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-vertx' diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/build.gradle b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/build.gradle index d9310aeaa316..554df629ee28 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/build.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/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.kotlin_version = '1.9.23' ext.vertx_version = "4.5.6" - // 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" } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/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/petstore/kotlin-jvm-vertx-jackson-coroutines/gradlew b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradlew +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/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/petstore/kotlin-jvm-vertx-jackson-coroutines/gradlew.bat b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/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/petstore/kotlin-jvm-vertx-jackson-coroutines/settings.gradle b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/settings.gradle index d8a62b9a59b2..956ff72ba57f 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-vertx' diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/build.gradle b/samples/client/petstore/kotlin-jvm-vertx-jackson/build.gradle index 9ade4e61c2d8..4fa9b2de93e1 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/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.kotlin_version = '1.9.23' ext.vertx_version = "4.5.6" - // 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" } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-vertx-jackson/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-vertx-jackson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-vertx-jackson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-vertx-jackson/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/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/petstore/kotlin-jvm-vertx-jackson/gradlew b/samples/client/petstore/kotlin-jvm-vertx-jackson/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/gradlew +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/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/petstore/kotlin-jvm-vertx-jackson/gradlew.bat b/samples/client/petstore/kotlin-jvm-vertx-jackson/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/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/petstore/kotlin-jvm-vertx-jackson/settings.gradle b/samples/client/petstore/kotlin-jvm-vertx-jackson/settings.gradle index d8a62b9a59b2..956ff72ba57f 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-vertx' diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/build.gradle b/samples/client/petstore/kotlin-jvm-vertx-moshi/build.gradle index 1ca32210bdb4..86537ceecdf7 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/build.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/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.kotlin_version = '1.9.23' ext.vertx_version = "4.5.6" - // 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" } diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-vertx-moshi/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-vertx-moshi/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-vertx-moshi/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-vertx-moshi/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/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/petstore/kotlin-jvm-vertx-moshi/gradlew b/samples/client/petstore/kotlin-jvm-vertx-moshi/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/gradlew +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/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/petstore/kotlin-jvm-vertx-moshi/gradlew.bat b/samples/client/petstore/kotlin-jvm-vertx-moshi/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/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/petstore/kotlin-jvm-vertx-moshi/settings.gradle b/samples/client/petstore/kotlin-jvm-vertx-moshi/settings.gradle index d8a62b9a59b2..956ff72ba57f 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-vertx' diff --git a/samples/client/petstore/kotlin-jvm-volley/build.gradle b/samples/client/petstore/kotlin-jvm-volley/build.gradle index e1597d417fe5..ccbdf66f37ef 100644 --- a/samples/client/petstore/kotlin-jvm-volley/build.gradle +++ b/samples/client/petstore/kotlin-jvm-volley/build.gradle @@ -1,7 +1,7 @@ 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" @@ -19,7 +19,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' } } diff --git a/samples/client/petstore/kotlin-jvm-volley/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-jvm-volley/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-jvm-volley/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-jvm-volley/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-jvm-volley/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-jvm-volley/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..4b01038305d2 100644 --- a/samples/client/petstore/kotlin-jvm-volley/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-jvm-volley/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-7.6.2-all.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/kotlin-jvm-volley/gradlew b/samples/client/petstore/kotlin-jvm-volley/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-volley/gradlew +++ b/samples/client/petstore/kotlin-jvm-volley/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/petstore/kotlin-jvm-volley/gradlew.bat b/samples/client/petstore/kotlin-jvm-volley/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-jvm-volley/gradlew.bat +++ b/samples/client/petstore/kotlin-jvm-volley/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/petstore/kotlin-jvm-volley/settings.gradle b/samples/client/petstore/kotlin-jvm-volley/settings.gradle index a265a2200845..32bad6657a2b 100644 --- a/samples/client/petstore/kotlin-jvm-volley/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-volley/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-jvm-volley' diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/build.gradle b/samples/client/petstore/kotlin-kotlinx-datetime/build.gradle index 77f977911c18..361efdaa3b90 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/build.gradle +++ b/samples/client/petstore/kotlin-kotlinx-datetime/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-kotlinx-datetime/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-kotlinx-datetime/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-kotlinx-datetime/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-kotlinx-datetime/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-kotlinx-datetime/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/petstore/kotlin-kotlinx-datetime/gradlew b/samples/client/petstore/kotlin-kotlinx-datetime/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/gradlew +++ b/samples/client/petstore/kotlin-kotlinx-datetime/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/petstore/kotlin-kotlinx-datetime/gradlew.bat b/samples/client/petstore/kotlin-kotlinx-datetime/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/gradlew.bat +++ b/samples/client/petstore/kotlin-kotlinx-datetime/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/petstore/kotlin-kotlinx-datetime/settings.gradle b/samples/client/petstore/kotlin-kotlinx-datetime/settings.gradle index e5cd54b824d6..307a3980c2ef 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/settings.gradle +++ b/samples/client/petstore/kotlin-kotlinx-datetime/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-threetenbp' diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/build.gradle b/samples/client/petstore/kotlin-model-prefix-type-mappings/build.gradle index 7f1c4a578d0c..52b6635987da 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/build.gradle +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/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.kotlin_version = '1.9.23' ext.retrofitVersion = '2.10.0' - // 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" } diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/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/petstore/kotlin-model-prefix-type-mappings/gradlew b/samples/client/petstore/kotlin-model-prefix-type-mappings/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/gradlew +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/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/petstore/kotlin-model-prefix-type-mappings/gradlew.bat b/samples/client/petstore/kotlin-model-prefix-type-mappings/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/gradlew.bat +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/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/petstore/kotlin-model-prefix-type-mappings/settings.gradle b/samples/client/petstore/kotlin-model-prefix-type-mappings/settings.gradle index 4b38a2a52a34..e9557672dc88 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/settings.gradle +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-client-prefix-mapping' diff --git a/samples/client/petstore/kotlin-modelMutable/build.gradle b/samples/client/petstore/kotlin-modelMutable/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-modelMutable/build.gradle +++ b/samples/client/petstore/kotlin-modelMutable/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-modelMutable/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-modelMutable/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-modelMutable/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-modelMutable/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-modelMutable/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-modelMutable/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-modelMutable/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-modelMutable/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/petstore/kotlin-modelMutable/gradlew b/samples/client/petstore/kotlin-modelMutable/gradlew index aeb74cbb43e3..9d0ce634cb11 100755 --- a/samples/client/petstore/kotlin-modelMutable/gradlew +++ b/samples/client/petstore/kotlin-modelMutable/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/petstore/kotlin-modelMutable/gradlew.bat b/samples/client/petstore/kotlin-modelMutable/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-modelMutable/gradlew.bat +++ b/samples/client/petstore/kotlin-modelMutable/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/petstore/kotlin-modelMutable/settings.gradle b/samples/client/petstore/kotlin-modelMutable/settings.gradle index 0c14ef9e807e..b9814e3459a9 100644 --- a/samples/client/petstore/kotlin-modelMutable/settings.gradle +++ b/samples/client/petstore/kotlin-modelMutable/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-modelMutable' diff --git a/samples/client/petstore/kotlin-moshi-codegen/build.gradle b/samples/client/petstore/kotlin-moshi-codegen/build.gradle index c051d7f1d90d..4a0aa606cdd1 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/build.gradle +++ b/samples/client/petstore/kotlin-moshi-codegen/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-moshi-codegen/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-moshi-codegen/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-moshi-codegen/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-moshi-codegen/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-moshi-codegen/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-moshi-codegen/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-moshi-codegen/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/petstore/kotlin-moshi-codegen/gradlew b/samples/client/petstore/kotlin-moshi-codegen/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/gradlew +++ b/samples/client/petstore/kotlin-moshi-codegen/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/petstore/kotlin-moshi-codegen/gradlew.bat b/samples/client/petstore/kotlin-moshi-codegen/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/gradlew.bat +++ b/samples/client/petstore/kotlin-moshi-codegen/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/petstore/kotlin-moshi-codegen/settings.gradle b/samples/client/petstore/kotlin-moshi-codegen/settings.gradle index 8964919a841b..a49864cc295c 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/settings.gradle +++ b/samples/client/petstore/kotlin-moshi-codegen/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-moshi-codegen' diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/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/petstore/kotlin-multiplatform-kotlinx-datetime/gradlew b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradlew +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/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/petstore/kotlin-multiplatform-kotlinx-datetime/gradlew.bat b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/gradlew.bat +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/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/petstore/kotlin-name-parameter-mappings/build.gradle b/samples/client/petstore/kotlin-name-parameter-mappings/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-name-parameter-mappings/build.gradle +++ b/samples/client/petstore/kotlin-name-parameter-mappings/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-name-parameter-mappings/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-name-parameter-mappings/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-name-parameter-mappings/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-name-parameter-mappings/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-name-parameter-mappings/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-name-parameter-mappings/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-name-parameter-mappings/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-name-parameter-mappings/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/petstore/kotlin-name-parameter-mappings/gradlew b/samples/client/petstore/kotlin-name-parameter-mappings/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-name-parameter-mappings/gradlew +++ b/samples/client/petstore/kotlin-name-parameter-mappings/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/petstore/kotlin-name-parameter-mappings/gradlew.bat b/samples/client/petstore/kotlin-name-parameter-mappings/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-name-parameter-mappings/gradlew.bat +++ b/samples/client/petstore/kotlin-name-parameter-mappings/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/petstore/kotlin-name-parameter-mappings/settings.gradle b/samples/client/petstore/kotlin-name-parameter-mappings/settings.gradle index dcfbe72dd032..5a53369817d7 100644 --- a/samples/client/petstore/kotlin-name-parameter-mappings/settings.gradle +++ b/samples/client/petstore/kotlin-name-parameter-mappings/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-client' diff --git a/samples/client/petstore/kotlin-nonpublic/build.gradle b/samples/client/petstore/kotlin-nonpublic/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-nonpublic/build.gradle +++ b/samples/client/petstore/kotlin-nonpublic/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-nonpublic/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-nonpublic/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-nonpublic/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-nonpublic/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-nonpublic/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-nonpublic/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-nonpublic/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-nonpublic/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/petstore/kotlin-nonpublic/gradlew b/samples/client/petstore/kotlin-nonpublic/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-nonpublic/gradlew +++ b/samples/client/petstore/kotlin-nonpublic/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/petstore/kotlin-nonpublic/gradlew.bat b/samples/client/petstore/kotlin-nonpublic/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-nonpublic/gradlew.bat +++ b/samples/client/petstore/kotlin-nonpublic/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/petstore/kotlin-nonpublic/settings.gradle b/samples/client/petstore/kotlin-nonpublic/settings.gradle index 4247dff770fa..b12e60cec24c 100644 --- a/samples/client/petstore/kotlin-nonpublic/settings.gradle +++ b/samples/client/petstore/kotlin-nonpublic/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-nonpublic' diff --git a/samples/client/petstore/kotlin-nullable/build.gradle b/samples/client/petstore/kotlin-nullable/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-nullable/build.gradle +++ b/samples/client/petstore/kotlin-nullable/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-nullable/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-nullable/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-nullable/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-nullable/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-nullable/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-nullable/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-nullable/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-nullable/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/petstore/kotlin-nullable/gradlew b/samples/client/petstore/kotlin-nullable/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-nullable/gradlew +++ b/samples/client/petstore/kotlin-nullable/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/petstore/kotlin-nullable/gradlew.bat b/samples/client/petstore/kotlin-nullable/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-nullable/gradlew.bat +++ b/samples/client/petstore/kotlin-nullable/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/petstore/kotlin-nullable/settings.gradle b/samples/client/petstore/kotlin-nullable/settings.gradle index 8ce2d0f6b277..229267927ecf 100644 --- a/samples/client/petstore/kotlin-nullable/settings.gradle +++ b/samples/client/petstore/kotlin-nullable/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-nullable' diff --git a/samples/client/petstore/kotlin-retrofit2-jackson/build.gradle b/samples/client/petstore/kotlin-retrofit2-jackson/build.gradle index 79ca18b68f6c..ad7aa14b2af3 100644 --- a/samples/client/petstore/kotlin-retrofit2-jackson/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2-jackson/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.kotlin_version = '1.9.23' ext.retrofitVersion = '2.10.0' - // 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" } diff --git a/samples/client/petstore/kotlin-retrofit2-jackson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-retrofit2-jackson/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-retrofit2-jackson/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-retrofit2-jackson/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-retrofit2-jackson/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-retrofit2-jackson/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-retrofit2-jackson/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-retrofit2-jackson/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/petstore/kotlin-retrofit2-jackson/gradlew b/samples/client/petstore/kotlin-retrofit2-jackson/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-retrofit2-jackson/gradlew +++ b/samples/client/petstore/kotlin-retrofit2-jackson/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/petstore/kotlin-retrofit2-jackson/gradlew.bat b/samples/client/petstore/kotlin-retrofit2-jackson/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-retrofit2-jackson/gradlew.bat +++ b/samples/client/petstore/kotlin-retrofit2-jackson/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/petstore/kotlin-retrofit2-jackson/settings.gradle b/samples/client/petstore/kotlin-retrofit2-jackson/settings.gradle index 113e1aafbe57..e2b3193cca3b 100644 --- a/samples/client/petstore/kotlin-retrofit2-jackson/settings.gradle +++ b/samples/client/petstore/kotlin-retrofit2-jackson/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-retrofit2-jackson' diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle index b820c0859847..6abb28c9793c 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/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.kotlin_version = '1.9.23' ext.retrofitVersion = '2.10.0' - // 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" } diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/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/petstore/kotlin-retrofit2-kotlinx_serialization/gradlew b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradlew +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/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/petstore/kotlin-retrofit2-kotlinx_serialization/gradlew.bat b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/gradlew.bat +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/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/petstore/kotlin-retrofit2-kotlinx_serialization/settings.gradle b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/settings.gradle index 556f35f68de5..c569ae798a5b 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/settings.gradle +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-retrofit2-kotlinx_serialization' diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle b/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle index efca7577c2d2..b5d6c0c4d67a 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle @@ -2,16 +2,15 @@ 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.kotlin_version = '1.9.23' ext.retrofitVersion = '2.10.0' ext.rxJava3Version = '3.1.8' - // 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" } diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-retrofit2-rx3/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-retrofit2-rx3/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-retrofit2-rx3/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-retrofit2-rx3/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-retrofit2-rx3/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/petstore/kotlin-retrofit2-rx3/gradlew b/samples/client/petstore/kotlin-retrofit2-rx3/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/gradlew +++ b/samples/client/petstore/kotlin-retrofit2-rx3/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/petstore/kotlin-retrofit2-rx3/gradlew.bat b/samples/client/petstore/kotlin-retrofit2-rx3/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/gradlew.bat +++ b/samples/client/petstore/kotlin-retrofit2-rx3/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/petstore/kotlin-retrofit2-rx3/settings.gradle b/samples/client/petstore/kotlin-retrofit2-rx3/settings.gradle index 18baad5eaecc..b24c7c5b8e4d 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/settings.gradle +++ b/samples/client/petstore/kotlin-retrofit2-rx3/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-retrofit2-rx3' diff --git a/samples/client/petstore/kotlin-retrofit2/build.gradle b/samples/client/petstore/kotlin-retrofit2/build.gradle index 3ad1cc276095..c7f6c8755de8 100644 --- a/samples/client/petstore/kotlin-retrofit2/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2/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.kotlin_version = '1.9.23' ext.retrofitVersion = '2.10.0' - // 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" } diff --git a/samples/client/petstore/kotlin-retrofit2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-retrofit2/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-retrofit2/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-retrofit2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-retrofit2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-retrofit2/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-retrofit2/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-retrofit2/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/petstore/kotlin-retrofit2/gradlew b/samples/client/petstore/kotlin-retrofit2/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-retrofit2/gradlew +++ b/samples/client/petstore/kotlin-retrofit2/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/petstore/kotlin-retrofit2/gradlew.bat b/samples/client/petstore/kotlin-retrofit2/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-retrofit2/gradlew.bat +++ b/samples/client/petstore/kotlin-retrofit2/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/petstore/kotlin-retrofit2/settings.gradle b/samples/client/petstore/kotlin-retrofit2/settings.gradle index 756030cbf49d..01c60542d300 100644 --- a/samples/client/petstore/kotlin-retrofit2/settings.gradle +++ b/samples/client/petstore/kotlin-retrofit2/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-retrofit2' diff --git a/samples/client/petstore/kotlin-string/build.gradle b/samples/client/petstore/kotlin-string/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin-string/build.gradle +++ b/samples/client/petstore/kotlin-string/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-string/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-string/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-string/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-string/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-string/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-string/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-string/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-string/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/petstore/kotlin-string/gradlew b/samples/client/petstore/kotlin-string/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-string/gradlew +++ b/samples/client/petstore/kotlin-string/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/petstore/kotlin-string/gradlew.bat b/samples/client/petstore/kotlin-string/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-string/gradlew.bat +++ b/samples/client/petstore/kotlin-string/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/petstore/kotlin-string/settings.gradle b/samples/client/petstore/kotlin-string/settings.gradle index d7f651640938..9742263a6a20 100644 --- a/samples/client/petstore/kotlin-string/settings.gradle +++ b/samples/client/petstore/kotlin-string/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-string' diff --git a/samples/client/petstore/kotlin-threetenbp/build.gradle b/samples/client/petstore/kotlin-threetenbp/build.gradle index 453be26b7cf9..0942ac6f4f93 100644 --- a/samples/client/petstore/kotlin-threetenbp/build.gradle +++ b/samples/client/petstore/kotlin-threetenbp/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-threetenbp/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-threetenbp/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-threetenbp/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-threetenbp/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-threetenbp/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-threetenbp/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-threetenbp/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-threetenbp/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/petstore/kotlin-threetenbp/gradlew b/samples/client/petstore/kotlin-threetenbp/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-threetenbp/gradlew +++ b/samples/client/petstore/kotlin-threetenbp/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/petstore/kotlin-threetenbp/gradlew.bat b/samples/client/petstore/kotlin-threetenbp/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-threetenbp/gradlew.bat +++ b/samples/client/petstore/kotlin-threetenbp/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/petstore/kotlin-threetenbp/settings.gradle b/samples/client/petstore/kotlin-threetenbp/settings.gradle index e5cd54b824d6..307a3980c2ef 100644 --- a/samples/client/petstore/kotlin-threetenbp/settings.gradle +++ b/samples/client/petstore/kotlin-threetenbp/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-threetenbp' diff --git a/samples/client/petstore/kotlin-uppercase-enum/build.gradle b/samples/client/petstore/kotlin-uppercase-enum/build.gradle index 3e9802ed3363..4f06acff349e 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/build.gradle +++ b/samples/client/petstore/kotlin-uppercase-enum/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin-uppercase-enum/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-uppercase-enum/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin-uppercase-enum/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-uppercase-enum/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-uppercase-enum/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-uppercase-enum/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-uppercase-enum/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/petstore/kotlin-uppercase-enum/gradlew b/samples/client/petstore/kotlin-uppercase-enum/gradlew index aeb74cbb43e3..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/gradlew +++ b/samples/client/petstore/kotlin-uppercase-enum/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/petstore/kotlin-uppercase-enum/gradlew.bat b/samples/client/petstore/kotlin-uppercase-enum/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/gradlew.bat +++ b/samples/client/petstore/kotlin-uppercase-enum/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/petstore/kotlin-uppercase-enum/settings.gradle b/samples/client/petstore/kotlin-uppercase-enum/settings.gradle index 874f5b0c03e6..10ea523a2a15 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/settings.gradle +++ b/samples/client/petstore/kotlin-uppercase-enum/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-uppercase-enum' diff --git a/samples/client/petstore/kotlin/build.gradle b/samples/client/petstore/kotlin/build.gradle index a3aaa60ac433..ae12ac6e1442 100644 --- a/samples/client/petstore/kotlin/build.gradle +++ b/samples/client/petstore/kotlin/build.gradle @@ -2,14 +2,13 @@ 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' - // 6.13.0 is the latest stable release that supports JDK8 - ext.spotless_version = "6.13.0" + ext.kotlin_version = '1.9.23' + ext.spotless_version = "6.25.0" repositories { maven { url "https://repo1.maven.org/maven2" } diff --git a/samples/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d..d64cd4917707 100644 Binary files a/samples/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties index 8707e8b5067f..e7646dead063 100644 --- a/samples/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin/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/petstore/kotlin/gradlew b/samples/client/petstore/kotlin/gradlew index aeb74cbb43e3..9d0ce634cb11 100755 --- a/samples/client/petstore/kotlin/gradlew +++ b/samples/client/petstore/kotlin/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/petstore/kotlin/gradlew.bat b/samples/client/petstore/kotlin/gradlew.bat index 93e3f59f135d..9d0ce634cb11 100644 --- a/samples/client/petstore/kotlin/gradlew.bat +++ b/samples/client/petstore/kotlin/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/petstore/kotlin/settings.gradle b/samples/client/petstore/kotlin/settings.gradle index dcfbe72dd032..5a53369817d7 100644 --- a/samples/client/petstore/kotlin/settings.gradle +++ b/samples/client/petstore/kotlin/settings.gradle @@ -1,2 +1 @@ - rootProject.name = 'kotlin-petstore-client' diff --git a/samples/client/petstore/rust/Cargo.toml b/samples/client/petstore/rust/Cargo.toml index 46b06cf9bbe3..90aec2be42a2 100644 --- a/samples/client/petstore/rust/Cargo.toml +++ b/samples/client/petstore/rust/Cargo.toml @@ -1,2 +1,3 @@ [workspace] members = ["hyper/*", "reqwest/*"] +resolver = "2" diff --git a/samples/client/petstore/rust/hyper/petstore/Cargo.toml b/samples/client/petstore/rust/hyper/petstore/Cargo.toml index 60ee14ea87a8..d8b82608d379 100644 --- a/samples/client/petstore/rust/hyper/petstore/Cargo.toml +++ b/samples/client/petstore/rust/hyper/petstore/Cargo.toml @@ -4,15 +4,14 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters." license = "Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" -serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] } +serde = { version = "^1.0", features = ["derive"] } +serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } 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 = { version = "~0.14", features = ["full"] } hyper-tls = "~0.5" http = "~0.2" diff --git a/samples/client/petstore/rust/hyper/petstore/src/apis/mod.rs b/samples/client/petstore/rust/hyper/petstore/src/apis/mod.rs index 2abfb5a4e605..df848ad3c6b2 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/apis/mod.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/apis/mod.rs @@ -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/samples/client/petstore/rust/hyper/petstore/src/lib.rs b/samples/client/petstore/rust/hyper/petstore/src/lib.rs index b49043ca0402..1de74d07cff1 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/lib.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/lib.rs @@ -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/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs b/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs index 81cca99e8ac1..11d2f0b87124 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/api_response.rs b/samples/client/petstore/rust/hyper/petstore/src/models/api_response.rs index 4814a31da533..0a60da0f4773 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/api_response.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/api_response.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ApiResponse : Describes the result of uploading an image resource #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/hyper/petstore/src/models/array_item_ref_test.rs index 5948b1809125..4ac1e8a2fe9c 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/array_item_ref_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ArrayItemRefTest : Test handling of object reference in arrays #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/baz.rs b/samples/client/petstore/rust/hyper/petstore/src/models/baz.rs index d2a840a2d671..dcf25d8465a3 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/baz.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/baz.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Baz : Test handling of empty variants /// Test handling of empty variants diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/category.rs b/samples/client/petstore/rust/hyper/petstore/src/models/category.rs index 2d2b29334de7..9ecf89d354d6 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/category.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/category.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Category : A category for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/enum_array_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/enum_array_testing.rs index 499c33595131..2ac40c307756 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/enum_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// EnumArrayTesting : Test of enum array #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/model_ref.rs b/samples/client/petstore/rust/hyper/petstore/src/models/model_ref.rs index cd0928bf9c2f..9862cb1a48ef 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/model_ref.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/model_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Ref : using reserved word as model name #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/model_return.rs b/samples/client/petstore/rust/hyper/petstore/src/models/model_return.rs index 933b644a7f3e..07d9268e6e68 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/model_return.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/model_return.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Return : Test using keywords #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/nullable_array.rs b/samples/client/petstore/rust/hyper/petstore/src/models/nullable_array.rs index 6ddbb5c0ecee..a155ea1176ab 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/nullable_array.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs index 57d224f831d9..72e5a009a623 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// OptionalTesting : Test handling of optional and nullable fields #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/order.rs b/samples/client/petstore/rust/hyper/petstore/src/models/order.rs index 5d16df143aac..e81f64a29808 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/order.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/order.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Order : An order for a pets from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/pet.rs b/samples/client/petstore/rust/hyper/petstore/src/models/pet.rs index 59d9a9f11587..785fb5390bed 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/pet.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/pet.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Pet : A pet for sale in the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/property_test.rs b/samples/client/petstore/rust/hyper/petstore/src/models/property_test.rs index 1b92525f28b9..c98e7c762b58 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/property_test.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/property_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// PropertyTest : A model to test various formats, e.g. UUID #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/tag.rs b/samples/client/petstore/rust/hyper/petstore/src/models/tag.rs index 151840c88567..8fe4eebd723b 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/tag.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/tag.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Tag : A tag for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs index dac3b59eb1fd..dba87bdb3cfd 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; use serde_with::serde_as; diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/unique_item_array_testing.rs index a40f77afc0ed..2a1f18ca9cee 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/unique_item_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// UniqueItemArrayTesting : Test handling of enum array with unique items #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/user.rs b/samples/client/petstore/rust/hyper/petstore/src/models/user.rs index f16b7f785f77..c88c469a4ebe 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/user.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/user.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// User : A User who is purchasing from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml b/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml index d7c5df28fbf6..120ba16c8826 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml @@ -4,14 +4,11 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "rust name mapping test" license = "Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" +serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs index e40fc8b66c4d..e7f8c27a8f05 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/name-mapping/src/lib.rs b/samples/client/petstore/rust/reqwest/name-mapping/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/name-mapping/src/lib.rs @@ -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/samples/client/petstore/rust/reqwest/name-mapping/src/models/property_name_mapping.rs b/samples/client/petstore/rust/reqwest/name-mapping/src/models/property_name_mapping.rs index e420ed1280c4..caf948339e08 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/src/models/property_name_mapping.rs +++ b/samples/client/petstore/rust/reqwest/name-mapping/src/models/property_name_mapping.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PropertyNameMapping { diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml index 8f223da87311..cd7d83abaa64 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml @@ -4,16 +4,13 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters." license = "Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" -serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] } +serde = { version = "^1.0", features = ["derive"] } +serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -reqwest-middleware = "0.2.0" -[dependencies.reqwest] -version = "^0.11" -features = ["json", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "multipart"] } +reqwest-middleware = { version = "^0.3", features = ["json", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/fake_api.rs index 78d3ba30ec0c..3f10b5b6c2af 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/fake_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs index ccdefa44be16..0a44b19a32dd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/store_api.rs index d08b7b74e46d..67fd03a80f54 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/store_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs index 86f87242fcc6..83d1a00fb4ce 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/user_api.rs index 32594255a63e..4f28c21c1cf3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/user_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/lib.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/lib.rs @@ -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/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/action_container.rs index 81cca99e8ac1..11d2f0b87124 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/action_container.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/api_response.rs index 4814a31da533..0a60da0f4773 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/api_response.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ApiResponse : Describes the result of uploading an image resource #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/array_item_ref_test.rs index 5948b1809125..4ac1e8a2fe9c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/array_item_ref_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ArrayItemRefTest : Test handling of object reference in arrays #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/baz.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/baz.rs index d2a840a2d671..dcf25d8465a3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/baz.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/baz.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Baz : Test handling of empty variants /// Test handling of empty variants diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/category.rs index 2d2b29334de7..9ecf89d354d6 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/category.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Category : A category for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/enum_array_testing.rs index 499c33595131..2ac40c307756 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/enum_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// EnumArrayTesting : Test of enum array #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_ref.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_ref.rs index cd0928bf9c2f..9862cb1a48ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_ref.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Ref : using reserved word as model name #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_return.rs index 933b644a7f3e..07d9268e6e68 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_return.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Return : Test using keywords #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/nullable_array.rs index 6ddbb5c0ecee..a155ea1176ab 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/nullable_array.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/optional_testing.rs index 57d224f831d9..72e5a009a623 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/optional_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// OptionalTesting : Test handling of optional and nullable fields #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs index 5d16df143aac..e81f64a29808 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Order : An order for a pets from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/pet.rs index 59d9a9f11587..785fb5390bed 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/pet.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Pet : A pet for sale in the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/property_test.rs index 1b92525f28b9..c98e7c762b58 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/property_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// PropertyTest : A model to test various formats, e.g. UUID #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/tag.rs index 151840c88567..8fe4eebd723b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/tag.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Tag : A tag for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs index dac3b59eb1fd..dba87bdb3cfd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; use serde_with::serde_as; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/unique_item_array_testing.rs index a40f77afc0ed..2a1f18ca9cee 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/unique_item_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// UniqueItemArrayTesting : Test handling of enum array with unique items #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/user.rs index f16b7f785f77..c88c469a4ebe 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/user.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// User : A User who is purchasing from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml index e84c3e698870..8fa64e90a2f0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml @@ -4,15 +4,12 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters." license = "Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" -serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] } +serde = { version = "^1.0", features = ["derive"] } +serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/fake_api.rs index 78d3ba30ec0c..3f10b5b6c2af 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/fake_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs index ccdefa44be16..0a44b19a32dd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs index d08b7b74e46d..67fd03a80f54 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs index 86f87242fcc6..83d1a00fb4ce 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs index 32594255a63e..4f28c21c1cf3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/lib.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/lib.rs @@ -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/samples/client/petstore/rust/reqwest/petstore-async/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/action_container.rs index 81cca99e8ac1..11d2f0b87124 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/action_container.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/api_response.rs index 4814a31da533..0a60da0f4773 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/api_response.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ApiResponse : Describes the result of uploading an image resource #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/array_item_ref_test.rs index 5948b1809125..4ac1e8a2fe9c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/array_item_ref_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ArrayItemRefTest : Test handling of object reference in arrays #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/baz.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/baz.rs index d2a840a2d671..dcf25d8465a3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/baz.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/baz.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Baz : Test handling of empty variants /// Test handling of empty variants diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/category.rs index 2d2b29334de7..9ecf89d354d6 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/category.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Category : A category for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/enum_array_testing.rs index 499c33595131..2ac40c307756 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/enum_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// EnumArrayTesting : Test of enum array #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_ref.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_ref.rs index cd0928bf9c2f..9862cb1a48ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_ref.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Ref : using reserved word as model name #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_return.rs index 933b644a7f3e..07d9268e6e68 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_return.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Return : Test using keywords #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/nullable_array.rs index 6ddbb5c0ecee..a155ea1176ab 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/nullable_array.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs index 57d224f831d9..72e5a009a623 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// OptionalTesting : Test handling of optional and nullable fields #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/order.rs index 5d16df143aac..e81f64a29808 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/order.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Order : An order for a pets from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/pet.rs index 59d9a9f11587..785fb5390bed 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/pet.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Pet : A pet for sale in the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/property_test.rs index 1b92525f28b9..c98e7c762b58 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/property_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// PropertyTest : A model to test various formats, e.g. UUID #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/tag.rs index 151840c88567..8fe4eebd723b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/tag.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Tag : A tag for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs index dac3b59eb1fd..dba87bdb3cfd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; use serde_with::serde_as; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/unique_item_array_testing.rs index a40f77afc0ed..2a1f18ca9cee 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/unique_item_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// UniqueItemArrayTesting : Test handling of enum array with unique items #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/user.rs index f16b7f785f77..c88c469a4ebe 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/user.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// User : A User who is purchasing from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml index 563dd98e2b1a..99fe8589bc8e 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml @@ -4,15 +4,12 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters." license = "Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" -serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] } +serde = { version = "^1.0", features = ["derive"] } +serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/fake_api.rs index 78d3ba30ec0c..3f10b5b6c2af 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/fake_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs index ccdefa44be16..0a44b19a32dd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/store_api.rs index d08b7b74e46d..67fd03a80f54 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/store_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs index 86f87242fcc6..83d1a00fb4ce 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/user_api.rs index 32594255a63e..4f28c21c1cf3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/user_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/lib.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/lib.rs @@ -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/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/action_container.rs index 870b2e3c68b9..0dd27c0e5c84 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/action_container.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/api_response.rs index 4814a31da533..0a60da0f4773 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/api_response.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ApiResponse : Describes the result of uploading an image resource #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/array_item_ref_test.rs index 5948b1809125..4ac1e8a2fe9c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/array_item_ref_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ArrayItemRefTest : Test handling of object reference in arrays #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/baz.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/baz.rs index d2a840a2d671..dcf25d8465a3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/baz.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/baz.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Baz : Test handling of empty variants /// Test handling of empty variants diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/category.rs index 2d2b29334de7..9ecf89d354d6 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/category.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Category : A category for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/enum_array_testing.rs index 499c33595131..2ac40c307756 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/enum_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// EnumArrayTesting : Test of enum array #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/model_ref.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/model_ref.rs index cd0928bf9c2f..9862cb1a48ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/model_ref.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/model_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Ref : using reserved word as model name #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/model_return.rs index 933b644a7f3e..07d9268e6e68 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/model_return.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Return : Test using keywords #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/nullable_array.rs index 6ddbb5c0ecee..a155ea1176ab 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/nullable_array.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/optional_testing.rs index 57d224f831d9..72e5a009a623 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/optional_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// OptionalTesting : Test handling of optional and nullable fields #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/order.rs index 5d16df143aac..e81f64a29808 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/order.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Order : An order for a pets from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/pet.rs index 1cbe779e1eaa..9d5606d017f3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/pet.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Pet : A pet for sale in the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/property_test.rs index 1b92525f28b9..c98e7c762b58 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/property_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// PropertyTest : A model to test various formats, e.g. UUID #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/tag.rs index 151840c88567..8fe4eebd723b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/tag.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Tag : A tag for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/type_testing.rs index dac3b59eb1fd..dba87bdb3cfd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/type_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; use serde_with::serde_as; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/unique_item_array_testing.rs index a40f77afc0ed..2a1f18ca9cee 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/unique_item_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// UniqueItemArrayTesting : Test handling of enum array with unique items #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/user.rs index f16b7f785f77..c88c469a4ebe 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/user.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// User : A User who is purchasing from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml index b15e4c914597..31b50f4eed1c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml @@ -4,18 +4,15 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters." license = "Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" -serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] } +serde = { version = "^1.0", features = ["derive"] } +serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } aws-sigv4 = "0.3.0" http = "0.2.5" secrecy = "0.8.0" -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/configuration.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/configuration.rs index e8b030ae01b9..f401dc386376 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/configuration.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/configuration.rs @@ -68,7 +68,7 @@ impl AWSv4Key { value.to_str().expect("header value should be a string").to_string())); } } - return Ok(additional_headers); + Ok(additional_headers) } } diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs index af7818dd030b..d14a0f233be3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs index ff120978fc73..c48cfb3b2f90 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; @@ -140,7 +140,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, "DELETE", - &"", + "", ) { Ok(new_headers) => new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), @@ -191,7 +191,7 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, "GET", - &"", + "", ) { Ok(new_headers) => new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), @@ -239,7 +239,7 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, "GET", - &"", + "", ) { Ok(new_headers) => new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), @@ -283,7 +283,7 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, "GET", - &"", + "", ) { Ok(new_headers) => new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), @@ -377,7 +377,7 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, "POST", - &"", + "", ) { Ok(new_headers) => new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), @@ -429,7 +429,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, "POST", - &"", + "", ) { Ok(new_headers) => new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs index 3f42d04d3ece..fd42617f4c7d 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; @@ -90,7 +90,7 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs index f6bca74913ea..c53219078f0e 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs index b1f475f2a041..0eedaddc2e48 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; @@ -246,7 +246,7 @@ pub fn delete_user(configuration: &configuration::Configuration, username: &str) let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, "DELETE", - &"", + "", ) { Ok(new_headers) => new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), @@ -353,7 +353,7 @@ pub fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, "GET", - &"", + "", ) { Ok(new_headers) => new_headers, Err(err) => return Err(Error::AWSV4SignatureError(err)), diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/lib.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/lib.rs @@ -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/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/action_container.rs index 81cca99e8ac1..11d2f0b87124 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/action_container.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/api_response.rs index 4814a31da533..0a60da0f4773 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/api_response.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ApiResponse : Describes the result of uploading an image resource #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/array_item_ref_test.rs index 5948b1809125..4ac1e8a2fe9c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/array_item_ref_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ArrayItemRefTest : Test handling of object reference in arrays #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/baz.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/baz.rs index d2a840a2d671..dcf25d8465a3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/baz.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/baz.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Baz : Test handling of empty variants /// Test handling of empty variants diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/category.rs index 2d2b29334de7..9ecf89d354d6 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/category.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Category : A category for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/enum_array_testing.rs index 499c33595131..2ac40c307756 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/enum_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// EnumArrayTesting : Test of enum array #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_ref.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_ref.rs index cd0928bf9c2f..9862cb1a48ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_ref.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Ref : using reserved word as model name #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_return.rs index 933b644a7f3e..07d9268e6e68 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_return.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Return : Test using keywords #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/nullable_array.rs index 6ddbb5c0ecee..a155ea1176ab 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/nullable_array.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs index 57d224f831d9..72e5a009a623 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// OptionalTesting : Test handling of optional and nullable fields #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/order.rs index 5d16df143aac..e81f64a29808 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/order.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Order : An order for a pets from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/pet.rs index 59d9a9f11587..785fb5390bed 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/pet.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Pet : A pet for sale in the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/property_test.rs index 1b92525f28b9..c98e7c762b58 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/property_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// PropertyTest : A model to test various formats, e.g. UUID #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/tag.rs index 151840c88567..8fe4eebd723b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/tag.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Tag : A tag for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs index dac3b59eb1fd..dba87bdb3cfd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; use serde_with::serde_as; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/unique_item_array_testing.rs index a40f77afc0ed..2a1f18ca9cee 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/unique_item_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// UniqueItemArrayTesting : Test handling of enum array with unique items #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/user.rs index f16b7f785f77..c88c469a4ebe 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/user.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// User : A User who is purchasing from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore/Cargo.toml index 5ec1e2d4130d..5e0e14f51208 100644 --- a/samples/client/petstore/rust/reqwest/petstore/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore/Cargo.toml @@ -4,15 +4,12 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters." license = "Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] -serde = "^1.0" -serde_derive = "^1.0" -serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] } +serde = { version = "^1.0", features = ["derive"] } +serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" -url = "^2.2" -uuid = { version = "^1.0", features = ["serde", "v4"] } -[dependencies.reqwest] -version = "^0.11" -features = ["json", "blocking", "multipart"] +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } +reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs index af7818dd030b..d14a0f233be3 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs index 70dec4dca247..ebff8f8dde98 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs index a29eba98354e..98c889e0e55f 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs index f6bca74913ea..c53219078f0e 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs index ec400432aae8..2f328ace6051 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs @@ -10,7 +10,7 @@ use reqwest; - +use serde::{Deserialize, Serialize}; use crate::{apis::ResponseContent, models}; use super::{Error, configuration}; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/lib.rs b/samples/client/petstore/rust/reqwest/petstore/src/lib.rs index 1ac114198fdd..a1837b966dc7 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/lib.rs @@ -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/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs index 81cca99e8ac1..11d2f0b87124 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/api_response.rs index 4814a31da533..0a60da0f4773 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/api_response.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ApiResponse : Describes the result of uploading an image resource #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/array_item_ref_test.rs index 5948b1809125..4ac1e8a2fe9c 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/array_item_ref_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// ArrayItemRefTest : Test handling of object reference in arrays #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/baz.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/baz.rs index d2a840a2d671..dcf25d8465a3 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/baz.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/baz.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Baz : Test handling of empty variants /// Test handling of empty variants diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/category.rs index 2d2b29334de7..9ecf89d354d6 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/category.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Category : A category for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/enum_array_testing.rs index 499c33595131..2ac40c307756 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/enum_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// EnumArrayTesting : Test of enum array #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/model_ref.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/model_ref.rs index cd0928bf9c2f..9862cb1a48ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/model_ref.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/model_ref.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Ref : using reserved word as model name #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/model_return.rs index 933b644a7f3e..07d9268e6e68 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/model_return.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Return : Test using keywords #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/nullable_array.rs index 6ddbb5c0ecee..a155ea1176ab 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/nullable_array.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/optional_testing.rs index 57d224f831d9..72e5a009a623 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/optional_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// OptionalTesting : Test handling of optional and nullable fields #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/order.rs index d27d4f8893e4..a66e7dbb5689 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/order.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Order : An order for a pets from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/pet.rs index 59d9a9f11587..785fb5390bed 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/pet.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Pet : A pet for sale in the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/property_test.rs index 1b92525f28b9..c98e7c762b58 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/property_test.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// PropertyTest : A model to test various formats, e.g. UUID #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/tag.rs index 151840c88567..8fe4eebd723b 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/tag.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// Tag : A tag for a pet #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs index dac3b59eb1fd..dba87bdb3cfd 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; use serde_with::serde_as; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/unique_item_array_testing.rs index a40f77afc0ed..2a1f18ca9cee 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/unique_item_array_testing.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// UniqueItemArrayTesting : Test handling of enum array with unique items #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/user.rs index f16b7f785f77..c88c469a4ebe 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/user.rs @@ -9,6 +9,7 @@ */ use crate::models; +use serde::{Deserialize, Serialize}; /// User : A User who is purchasing from the pet store #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AnimalDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AnimalDto.java index 44e5b8fa3028..d36702d7ff79 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AnimalDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AnimalDto.java @@ -38,6 +38,10 @@ public class AnimalDto { private String color = "red"; + public AnimalDto() { + super(); + } + public AnimalDto className(String className) { this.className = className; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/BigCatDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/BigCatDto.java index f553a91984ab..d6135166c01b 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/BigCatDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/BigCatDto.java @@ -68,6 +68,10 @@ public static KindEnum fromValue(String value) { private KindEnum kind; + public BigCatDto() { + super(); + } + public BigCatDto kind(KindEnum kind) { this.kind = kind; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java index 0e30926c5888..3995db6ffc3c 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java @@ -35,6 +35,10 @@ public class CatDto extends AnimalDto { private Boolean declawed; + public CatDto() { + super(); + } + public CatDto declawed(Boolean declawed) { this.declawed = declawed; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CategoryDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CategoryDto.java index 02ce02a379f3..89ff9fa19fb2 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CategoryDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CategoryDto.java @@ -25,6 +25,10 @@ public class CategoryDto { private String name = "default-name"; + public CategoryDto() { + super(); + } + public CategoryDto id(Long id) { this.id = id; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 70196eb63781..ef3f88318504 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -38,6 +38,10 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArrayWithDefault = JsonNullable.>undefined(); + public ContainerDefaultValueDto() { + super(); + } + public ContainerDefaultValueDto nullableArray(List nullableArray) { this.nullableArray = JsonNullable.of(nullableArray); return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/DogDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/DogDto.java index 748d5c85e1e4..2908d6ab58b5 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/DogDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/DogDto.java @@ -28,6 +28,10 @@ public class DogDto extends AnimalDto { private String breed; + public DogDto() { + super(); + } + public DogDto breed(String breed) { this.breed = breed; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/EnumTestDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/EnumTestDto.java index 8e73ea12f51c..886cf55a8d57 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/EnumTestDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/EnumTestDto.java @@ -177,6 +177,10 @@ public static EnumNumberEnum fromValue(Double value) { private OuterEnumDto outerEnum; + public EnumTestDto() { + super(); + } + public EnumTestDto enumString(EnumStringEnum enumString) { this.enumString = enumString; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/FormatTestDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/FormatTestDto.java index 2692c75642cb..4b98f966436a 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/FormatTestDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/FormatTestDto.java @@ -57,6 +57,10 @@ public class FormatTestDto { private BigDecimal bigDecimal; + public FormatTestDto() { + super(); + } + public FormatTestDto integer(Integer integer) { this.integer = integer; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NameDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NameDto.java index 8a6c2223d55c..d29684ae3761 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NameDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NameDto.java @@ -29,6 +29,10 @@ public class NameDto { private Integer _123number; + public NameDto() { + super(); + } + public NameDto name(Integer name) { this.name = name; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/PetDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/PetDto.java index 4726e9d2c1b4..214d5c957972 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/PetDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/PetDto.java @@ -82,6 +82,10 @@ public static StatusEnum fromValue(String value) { @Deprecated private StatusEnum status; + public PetDto() { + super(); + } + public PetDto id(Long id) { this.id = id; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderDefaultDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderDefaultDto.java index bd2d7912f73c..34e89c82c024 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderDefaultDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderDefaultDto.java @@ -36,6 +36,10 @@ public class TypeHolderDefaultDto { private List arrayItem = new ArrayList<>(Arrays.asList(0, 1, 2, 3)); + public TypeHolderDefaultDto() { + super(); + } + public TypeHolderDefaultDto stringItem(String stringItem) { this.stringItem = stringItem; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderExampleDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderExampleDto.java index 8d13be7fb34b..5157899f0a70 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderExampleDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderExampleDto.java @@ -38,6 +38,10 @@ public class TypeHolderExampleDto { private List arrayItem = new ArrayList<>(); + public TypeHolderExampleDto() { + super(); + } + public TypeHolderExampleDto stringItem(String stringItem) { this.stringItem = stringItem; return this; diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts index a1b091662a1d..a5f85d1cc610 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts @@ -13,11 +13,8 @@ */ import { mapValues } from '../runtime'; -import { - CatFromJSONTyped, - DogFromJSONTyped -} from './index'; - +import { CatFromJSONTyped } from './Cat'; +import { DogFromJSONTyped } from './Dog'; /** * * @export diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts index 2642db808993..d83d77aa5f57 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts @@ -26,7 +26,14 @@ export type EnumClass = typeof EnumClass[keyof typeof EnumClass]; export function instanceOfEnumClass(value: any): boolean { - return Object.values(EnumClass).includes(value); + for (const key in EnumClass) { + if (Object.prototype.hasOwnProperty.call(EnumClass, key)) { + if (EnumClass[key] === value) { + return true; + } + } + } + return false; } export function EnumClassFromJSON(json: any): EnumClass { diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts index dbe67a7cf1f7..caeccfc55388 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts @@ -19,24 +19,24 @@ import { OuterEnumFromJSONTyped, OuterEnumToJSON, } from './OuterEnum'; -import type { OuterEnumDefaultValue } from './OuterEnumDefaultValue'; +import type { OuterEnumIntegerDefaultValue } from './OuterEnumIntegerDefaultValue'; import { - OuterEnumDefaultValueFromJSON, - OuterEnumDefaultValueFromJSONTyped, - OuterEnumDefaultValueToJSON, -} from './OuterEnumDefaultValue'; + OuterEnumIntegerDefaultValueFromJSON, + OuterEnumIntegerDefaultValueFromJSONTyped, + OuterEnumIntegerDefaultValueToJSON, +} from './OuterEnumIntegerDefaultValue'; import type { OuterEnumInteger } from './OuterEnumInteger'; import { OuterEnumIntegerFromJSON, OuterEnumIntegerFromJSONTyped, OuterEnumIntegerToJSON, } from './OuterEnumInteger'; -import type { OuterEnumIntegerDefaultValue } from './OuterEnumIntegerDefaultValue'; +import type { OuterEnumDefaultValue } from './OuterEnumDefaultValue'; import { - OuterEnumIntegerDefaultValueFromJSON, - OuterEnumIntegerDefaultValueFromJSONTyped, - OuterEnumIntegerDefaultValueToJSON, -} from './OuterEnumIntegerDefaultValue'; + OuterEnumDefaultValueFromJSON, + OuterEnumDefaultValueFromJSONTyped, + OuterEnumDefaultValueToJSON, +} from './OuterEnumDefaultValue'; /** * diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts index 1e1bb96977f0..a35b7561819f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts @@ -26,7 +26,14 @@ export type OuterEnum = typeof OuterEnum[keyof typeof OuterEnum]; export function instanceOfOuterEnum(value: any): boolean { - return Object.values(OuterEnum).includes(value); + for (const key in OuterEnum) { + if (Object.prototype.hasOwnProperty.call(OuterEnum, key)) { + if (OuterEnum[key] === value) { + return true; + } + } + } + return false; } export function OuterEnumFromJSON(json: any): OuterEnum { diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts index 93a84658c1ce..08c50c71d689 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts @@ -26,7 +26,14 @@ export type OuterEnumDefaultValue = typeof OuterEnumDefaultValue[keyof typeof Ou export function instanceOfOuterEnumDefaultValue(value: any): boolean { - return Object.values(OuterEnumDefaultValue).includes(value); + for (const key in OuterEnumDefaultValue) { + if (Object.prototype.hasOwnProperty.call(OuterEnumDefaultValue, key)) { + if (OuterEnumDefaultValue[key] === value) { + return true; + } + } + } + return false; } export function OuterEnumDefaultValueFromJSON(json: any): OuterEnumDefaultValue { diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts index 9ca8643211c8..4c017a1ceb5b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts @@ -26,7 +26,14 @@ export type OuterEnumInteger = typeof OuterEnumInteger[keyof typeof OuterEnumInt export function instanceOfOuterEnumInteger(value: any): boolean { - return Object.values(OuterEnumInteger).includes(value); + for (const key in OuterEnumInteger) { + if (Object.prototype.hasOwnProperty.call(OuterEnumInteger, key)) { + if (OuterEnumInteger[key] === value) { + return true; + } + } + } + return false; } export function OuterEnumIntegerFromJSON(json: any): OuterEnumInteger { diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts index 7daa71a99ec6..8e16b56eedae 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts @@ -26,7 +26,14 @@ export type OuterEnumIntegerDefaultValue = typeof OuterEnumIntegerDefaultValue[k export function instanceOfOuterEnumIntegerDefaultValue(value: any): boolean { - return Object.values(OuterEnumIntegerDefaultValue).includes(value); + for (const key in OuterEnumIntegerDefaultValue) { + if (Object.prototype.hasOwnProperty.call(OuterEnumIntegerDefaultValue, key)) { + if (OuterEnumIntegerDefaultValue[key] === value) { + return true; + } + } + } + return false; } export function OuterEnumIntegerDefaultValueFromJSON(json: any): OuterEnumIntegerDefaultValue { diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts index a593c5a384f9..c549674ec4a2 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts @@ -13,10 +13,7 @@ */ import { mapValues } from '../runtime'; -import { - ChildWithNullableFromJSONTyped -} from './index'; - +import { ChildWithNullableFromJSONTyped } from './ChildWithNullable'; /** * * @export diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts index 60d49d6f22a5..7dbee0a8e95d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts @@ -25,7 +25,14 @@ export type SingleRefType = typeof SingleRefType[keyof typeof SingleRefType]; export function instanceOfSingleRefType(value: any): boolean { - return Object.values(SingleRefType).includes(value); + for (const key in SingleRefType) { + if (Object.prototype.hasOwnProperty.call(SingleRefType, key)) { + if (SingleRefType[key] === value) { + return true; + } + } + } + return false; } export function SingleRefTypeFromJSON(json: any): SingleRefType { diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts index a884536c2ccf..a0c1b58a29e7 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts @@ -26,7 +26,14 @@ export type NumberEnum = typeof NumberEnum[keyof typeof NumberEnum]; export function instanceOfNumberEnum(value: any): boolean { - return Object.values(NumberEnum).includes(value); + for (const key in NumberEnum) { + if (Object.prototype.hasOwnProperty.call(NumberEnum, key)) { + if (NumberEnum[key] === value) { + return true; + } + } + } + return false; } export function NumberEnumFromJSON(json: any): NumberEnum { diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts index 503619ddd8aa..c59850ed4b63 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts @@ -26,7 +26,14 @@ export type StringEnum = typeof StringEnum[keyof typeof StringEnum]; export function instanceOfStringEnum(value: any): boolean { - return Object.values(StringEnum).includes(value); + for (const key in StringEnum) { + if (Object.prototype.hasOwnProperty.call(StringEnum, key)) { + if (StringEnum[key] === value) { + return true; + } + } + } + return false; } export function StringEnumFromJSON(json: any): StringEnum { diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts index b2ce4c035d58..481793ab0bda 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts @@ -26,7 +26,14 @@ export type BehaviorType = typeof BehaviorType[keyof typeof BehaviorType]; export function instanceOfBehaviorType(value: any): boolean { - return Object.values(BehaviorType).includes(value); + for (const key in BehaviorType) { + if (Object.prototype.hasOwnProperty.call(BehaviorType, key)) { + if (BehaviorType[key] === value) { + return true; + } + } + } + return false; } export function BehaviorTypeFromJSON(json: any): BehaviorType { diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts index ee1f52f20a27..f04bfb6e45b7 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts @@ -35,7 +35,14 @@ export type DeploymentRequestStatus = typeof DeploymentRequestStatus[keyof typeo export function instanceOfDeploymentRequestStatus(value: any): boolean { - return Object.values(DeploymentRequestStatus).includes(value); + for (const key in DeploymentRequestStatus) { + if (Object.prototype.hasOwnProperty.call(DeploymentRequestStatus, key)) { + if (DeploymentRequestStatus[key] === value) { + return true; + } + } + } + return false; } export function DeploymentRequestStatusFromJSON(json: any): DeploymentRequestStatus { diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts index a562973d2684..13fe193a73f0 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts @@ -41,7 +41,14 @@ export type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode]; export function instanceOfErrorCode(value: any): boolean { - return Object.values(ErrorCode).includes(value); + for (const key in ErrorCode) { + if (Object.prototype.hasOwnProperty.call(ErrorCode, key)) { + if (ErrorCode[key] === value) { + return true; + } + } + } + return false; } export function ErrorCodeFromJSON(json: any): ErrorCode { diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts index 358b81b7f084..8101bbc1d26e 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts @@ -13,18 +13,18 @@ */ import { mapValues } from '../runtime'; -import type { Pet } from './Pet'; -import { - PetFromJSON, - PetFromJSONTyped, - PetToJSON, -} from './Pet'; import type { ResponseMeta } from './ResponseMeta'; import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, } from './ResponseMeta'; +import type { Pet } from './Pet'; +import { + PetFromJSON, + PetFromJSONTyped, + PetToJSON, +} from './Pet'; /** * diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts index bfbe7a34cd95..83b0d3308f0f 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts @@ -13,18 +13,18 @@ */ import { mapValues } from '../runtime'; -import type { ResponseMeta } from './ResponseMeta'; -import { - ResponseMetaFromJSON, - ResponseMetaFromJSONTyped, - ResponseMetaToJSON, -} from './ResponseMeta'; import type { User } from './User'; import { UserFromJSON, UserFromJSONTyped, UserToJSON, } from './User'; +import type { ResponseMeta } from './ResponseMeta'; +import { + ResponseMetaFromJSON, + ResponseMetaFromJSONTyped, + ResponseMetaToJSON, +} from './ResponseMeta'; /** * diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts index 1db258479c3a..aef34f1254fc 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts @@ -13,18 +13,18 @@ */ import { mapValues } from '../runtime'; -import type { MatchingParts } from './MatchingParts'; -import { - MatchingPartsFromJSON, - MatchingPartsFromJSONTyped, - MatchingPartsToJSON, -} from './MatchingParts'; import type { ResponseMeta } from './ResponseMeta'; import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, } from './ResponseMeta'; +import type { MatchingParts } from './MatchingParts'; +import { + MatchingPartsFromJSON, + MatchingPartsFromJSONTyped, + MatchingPartsToJSON, +} from './MatchingParts'; /** * diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts index 44815da1ca75..2b35d9f88880 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts @@ -13,18 +13,18 @@ */ import { mapValues } from '../runtime'; -import type { PetPartType } from './PetPartType'; -import { - PetPartTypeFromJSON, - PetPartTypeFromJSONTyped, - PetPartTypeToJSON, -} from './PetPartType'; import type { ResponseMeta } from './ResponseMeta'; import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, } from './ResponseMeta'; +import type { PetPartType } from './PetPartType'; +import { + PetPartTypeFromJSON, + PetPartTypeFromJSONTyped, + PetPartTypeToJSON, +} from './PetPartType'; /** * diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts index bf2426212c35..1aa5863611e9 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts @@ -26,7 +26,14 @@ export type PetPartType = typeof PetPartType[keyof typeof PetPartType]; export function instanceOfPetPartType(value: any): boolean { - return Object.values(PetPartType).includes(value); + for (const key in PetPartType) { + if (Object.prototype.hasOwnProperty.call(PetPartType, key)) { + if (PetPartType[key] === value) { + return true; + } + } + } + return false; } export function PetPartTypeFromJSON(json: any): PetPartType { diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts index 8906f49dd92f..4554cb6dff05 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts @@ -26,7 +26,14 @@ export type WarningCode = typeof WarningCode[keyof typeof WarningCode]; export function instanceOfWarningCode(value: any): boolean { - return Object.values(WarningCode).includes(value); + for (const key in WarningCode) { + if (Object.prototype.hasOwnProperty.call(WarningCode, key)) { + if (WarningCode[key] === value) { + return true; + } + } + } + return false; } export function WarningCodeFromJSON(json: any): WarningCode { diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts index c2394952c9de..5edd6e54feea 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts @@ -13,11 +13,8 @@ */ import { mapValues } from '../runtime'; -import { - CatFromJSONTyped, - DogFromJSONTyped -} from './index'; - +import { CatFromJSONTyped } from './Cat'; +import { DogFromJSONTyped } from './Dog'; /** * * @export diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts index 2642db808993..d83d77aa5f57 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts @@ -26,7 +26,14 @@ export type EnumClass = typeof EnumClass[keyof typeof EnumClass]; export function instanceOfEnumClass(value: any): boolean { - return Object.values(EnumClass).includes(value); + for (const key in EnumClass) { + if (Object.prototype.hasOwnProperty.call(EnumClass, key)) { + if (EnumClass[key] === value) { + return true; + } + } + } + return false; } export function EnumClassFromJSON(json: any): EnumClass { diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts index dbe67a7cf1f7..caeccfc55388 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts @@ -19,24 +19,24 @@ import { OuterEnumFromJSONTyped, OuterEnumToJSON, } from './OuterEnum'; -import type { OuterEnumDefaultValue } from './OuterEnumDefaultValue'; +import type { OuterEnumIntegerDefaultValue } from './OuterEnumIntegerDefaultValue'; import { - OuterEnumDefaultValueFromJSON, - OuterEnumDefaultValueFromJSONTyped, - OuterEnumDefaultValueToJSON, -} from './OuterEnumDefaultValue'; + OuterEnumIntegerDefaultValueFromJSON, + OuterEnumIntegerDefaultValueFromJSONTyped, + OuterEnumIntegerDefaultValueToJSON, +} from './OuterEnumIntegerDefaultValue'; import type { OuterEnumInteger } from './OuterEnumInteger'; import { OuterEnumIntegerFromJSON, OuterEnumIntegerFromJSONTyped, OuterEnumIntegerToJSON, } from './OuterEnumInteger'; -import type { OuterEnumIntegerDefaultValue } from './OuterEnumIntegerDefaultValue'; +import type { OuterEnumDefaultValue } from './OuterEnumDefaultValue'; import { - OuterEnumIntegerDefaultValueFromJSON, - OuterEnumIntegerDefaultValueFromJSONTyped, - OuterEnumIntegerDefaultValueToJSON, -} from './OuterEnumIntegerDefaultValue'; + OuterEnumDefaultValueFromJSON, + OuterEnumDefaultValueFromJSONTyped, + OuterEnumDefaultValueToJSON, +} from './OuterEnumDefaultValue'; /** * diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts index 1e1bb96977f0..a35b7561819f 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts @@ -26,7 +26,14 @@ export type OuterEnum = typeof OuterEnum[keyof typeof OuterEnum]; export function instanceOfOuterEnum(value: any): boolean { - return Object.values(OuterEnum).includes(value); + for (const key in OuterEnum) { + if (Object.prototype.hasOwnProperty.call(OuterEnum, key)) { + if (OuterEnum[key] === value) { + return true; + } + } + } + return false; } export function OuterEnumFromJSON(json: any): OuterEnum { diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts index 93a84658c1ce..08c50c71d689 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts @@ -26,7 +26,14 @@ export type OuterEnumDefaultValue = typeof OuterEnumDefaultValue[keyof typeof Ou export function instanceOfOuterEnumDefaultValue(value: any): boolean { - return Object.values(OuterEnumDefaultValue).includes(value); + for (const key in OuterEnumDefaultValue) { + if (Object.prototype.hasOwnProperty.call(OuterEnumDefaultValue, key)) { + if (OuterEnumDefaultValue[key] === value) { + return true; + } + } + } + return false; } export function OuterEnumDefaultValueFromJSON(json: any): OuterEnumDefaultValue { diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts index 9ca8643211c8..4c017a1ceb5b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts @@ -26,7 +26,14 @@ export type OuterEnumInteger = typeof OuterEnumInteger[keyof typeof OuterEnumInt export function instanceOfOuterEnumInteger(value: any): boolean { - return Object.values(OuterEnumInteger).includes(value); + for (const key in OuterEnumInteger) { + if (Object.prototype.hasOwnProperty.call(OuterEnumInteger, key)) { + if (OuterEnumInteger[key] === value) { + return true; + } + } + } + return false; } export function OuterEnumIntegerFromJSON(json: any): OuterEnumInteger { diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts index 7daa71a99ec6..8e16b56eedae 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts @@ -26,7 +26,14 @@ export type OuterEnumIntegerDefaultValue = typeof OuterEnumIntegerDefaultValue[k export function instanceOfOuterEnumIntegerDefaultValue(value: any): boolean { - return Object.values(OuterEnumIntegerDefaultValue).includes(value); + for (const key in OuterEnumIntegerDefaultValue) { + if (Object.prototype.hasOwnProperty.call(OuterEnumIntegerDefaultValue, key)) { + if (OuterEnumIntegerDefaultValue[key] === value) { + return true; + } + } + } + return false; } export function OuterEnumIntegerDefaultValueFromJSON(json: any): OuterEnumIntegerDefaultValue { diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts index 60d49d6f22a5..7dbee0a8e95d 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts @@ -25,7 +25,14 @@ export type SingleRefType = typeof SingleRefType[keyof typeof SingleRefType]; export function instanceOfSingleRefType(value: any): boolean { - return Object.values(SingleRefType).includes(value); + for (const key in SingleRefType) { + if (Object.prototype.hasOwnProperty.call(SingleRefType, key)) { + if (SingleRefType[key] === value) { + return true; + } + } + } + return false; } export function SingleRefTypeFromJSON(json: any): SingleRefType { diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts index e65639e50eba..5b3ea298b9d0 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts @@ -25,7 +25,14 @@ export enum NumberEnum { export function instanceOfNumberEnum(value: any): boolean { - return Object.values(NumberEnum).includes(value); + for (const key in NumberEnum) { + if (Object.prototype.hasOwnProperty.call(NumberEnum, key)) { + if (NumberEnum[key] === value) { + return true; + } + } + } + return false; } export function NumberEnumFromJSON(json: any): NumberEnum { diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts index d8720fe1fe2b..21f232a76a91 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts @@ -25,7 +25,14 @@ export enum StringEnum { export function instanceOfStringEnum(value: any): boolean { - return Object.values(StringEnum).includes(value); + for (const key in StringEnum) { + if (Object.prototype.hasOwnProperty.call(StringEnum, key)) { + if (StringEnum[key] === value) { + return true; + } + } + } + return false; } export function StringEnumFromJSON(json: any): StringEnum { diff --git a/samples/documentation/html2/index.html b/samples/documentation/html2/index.html index cf96ef7cc25e..192377211d37 100644 --- a/samples/documentation/html2/index.html +++ b/samples/documentation/html2/index.html @@ -1482,6 +1482,8 @@

Parameters

} 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) { @@ -3912,6 +3914,8 @@

Parameters

} 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) { @@ -6712,6 +6716,8 @@

Parameters

} 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) { @@ -7207,6 +7213,8 @@

Parameters

} 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) { @@ -7623,6 +7631,8 @@

Parameters

} 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) { @@ -8039,6 +8049,8 @@

Parameters

} 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) { @@ -9512,19 +9524,19 @@

Description - SetMinusCookie + SetDashCookie String Cookie authentication key for use with the `api_key` apiKey authentication. - XMinusRateMinusLimit + XDashRateDashLimit Integer int32 calls per hour allowed by the user - XMinusExpiresMinusAfter + XDashExpiresDashAfter Date date-time date in UTC when token expires @@ -10308,6 +10320,8 @@

Parameters

} 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/samples/meta-codegen/lib/pom.xml b/samples/meta-codegen/lib/pom.xml index a91b878e04f4..472ad1993946 100644 --- a/samples/meta-codegen/lib/pom.xml +++ b/samples/meta-codegen/lib/pom.xml @@ -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 7.6.0-SNAPSHOT 1.0.0 - 4.13.2 + 5.10.2 diff --git a/samples/meta-codegen/lib/src/test/java/com/my/company/codegen/MyclientcodegenGeneratorTest.java b/samples/meta-codegen/lib/src/test/java/com/my/company/codegen/MyclientcodegenGeneratorTest.java index e49abd7033f8..be4607833628 100644 --- a/samples/meta-codegen/lib/src/test/java/com/my/company/codegen/MyclientcodegenGeneratorTest.java +++ b/samples/meta-codegen/lib/src/test/java/com/my/company/codegen/MyclientcodegenGeneratorTest.java @@ -1,6 +1,6 @@ package com.my.company.codegen; -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/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Animal.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Animal.java index 068799959339..b3e28e4f5fe9 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Animal.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Animal.java @@ -39,6 +39,10 @@ public class Animal { private String color = "red"; + public Animal() { + super(); + } + public Animal className(String className) { this.className = className; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java index c54b405645a8..726eaf23ad98 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java @@ -68,6 +68,10 @@ public static KindEnum fromValue(String value) { private KindEnum kind; + public BigCat() { + super(); + } + public BigCat kind(KindEnum kind) { this.kind = kind; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java index 8366e7149256..55794fb00397 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java @@ -36,6 +36,10 @@ public class Cat extends Animal { private Boolean declawed; + public Cat() { + super(); + } + public Cat declawed(Boolean declawed) { this.declawed = declawed; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Category.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Category.java index 3fa679c6bbc7..2b9f60ef4823 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Category.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Category.java @@ -25,6 +25,10 @@ public class Category { private String name = "default-name"; + public Category() { + super(); + } + public Category id(Long id) { this.id = id; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java index bb314c27287e..e013f78828ed 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -38,6 +38,10 @@ public class ContainerDefaultValue { @Valid private JsonNullable> nullableArrayWithDefault = JsonNullable.>undefined(); + public ContainerDefaultValue() { + super(); + } + public ContainerDefaultValue nullableArray(List nullableArray) { this.nullableArray = JsonNullable.of(nullableArray); return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java index e7777688a7c4..d005b69e4fa8 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java @@ -28,6 +28,10 @@ public class Dog extends Animal { private String breed; + public Dog() { + super(); + } + public Dog breed(String breed) { this.breed = breed; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/EnumTest.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/EnumTest.java index 1841d6bb31d8..1c16a0555aee 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/EnumTest.java @@ -179,6 +179,10 @@ public static EnumNumberEnum fromValue(Double value) { private OuterEnum outerEnum; + public EnumTest() { + super(); + } + public EnumTest enumString(EnumStringEnum enumString) { this.enumString = enumString; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java index 9b8b3be2de49..50746ecdd616 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java @@ -59,6 +59,10 @@ public class FormatTest { private BigDecimal bigDecimal; + public FormatTest() { + super(); + } + public FormatTest integer(Integer integer) { this.integer = integer; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Name.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Name.java index 946fb99c46b0..a21811357d10 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Name.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Name.java @@ -30,6 +30,10 @@ public class Name { private Integer _123number; + public Name() { + super(); + } + public Name name(Integer name) { this.name = name; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java index 373403327baa..d76bebcb59ba 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java @@ -82,6 +82,10 @@ public static StatusEnum fromValue(String value) { @Deprecated private StatusEnum status; + public Pet() { + super(); + } + public Pet id(Long id) { this.id = id; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderDefault.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderDefault.java index aa81da79d442..28e9d3857b1e 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderDefault.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderDefault.java @@ -36,6 +36,10 @@ public class TypeHolderDefault { @Valid private List arrayItem = new ArrayList<>(Arrays.asList(0, 1, 2, 3)); + public TypeHolderDefault() { + super(); + } + public TypeHolderDefault stringItem(String stringItem) { this.stringItem = stringItem; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderExample.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderExample.java index 56a2b8a20dd5..1902ac76685a 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderExample.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderExample.java @@ -38,6 +38,10 @@ public class TypeHolderExample { @Valid private List arrayItem = new ArrayList<>(); + public TypeHolderExample() { + super(); + } + public TypeHolderExample stringItem(String stringItem) { this.stringItem = stringItem; return this; diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go index 7d3b5c467612..5b043ad51bcd 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet.go @@ -36,7 +36,7 @@ func WithPetAPIErrorHandler(h ErrorHandler) PetAPIOption { } // NewPetAPIController creates a default api controller -func NewPetAPIController(s PetAPIServicer, opts ...PetAPIOption) Router { +func NewPetAPIController(s PetAPIServicer, opts ...PetAPIOption) *PetAPIController { controller := &PetAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -119,7 +119,7 @@ func (c *PetAPIController) AddPet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // DeletePet - Deletes a pet @@ -140,7 +140,7 @@ func (c *PetAPIController) DeletePet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // FindPetsByStatus - Finds Pets by status @@ -161,7 +161,7 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // FindPetsByTags - Finds Pets by tags @@ -183,7 +183,7 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetById - Find pet by ID @@ -203,7 +203,7 @@ func (c *PetAPIController) GetPetById(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdatePet - Update an existing pet @@ -230,7 +230,7 @@ func (c *PetAPIController) UpdatePet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdatePetWithForm - Updates a pet in the store with form data @@ -260,7 +260,7 @@ func (c *PetAPIController) UpdatePetWithForm(w http.ResponseWriter, r *http.Requ return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UploadFile - uploads an image @@ -299,5 +299,5 @@ func (c *PetAPIController) UploadFile(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go index d1779d117469..cea78ae519a5 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_pet_service.go @@ -24,7 +24,7 @@ type PetAPIService struct { } // NewPetAPIService creates a default api service -func NewPetAPIService() PetAPIServicer { +func NewPetAPIService() *PetAPIService { return &PetAPIService{} } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_store.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_store.go index 2bcc6ccd7691..e364efe39889 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_store.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_store.go @@ -35,7 +35,7 @@ func WithStoreAPIErrorHandler(h ErrorHandler) StoreAPIOption { } // NewStoreAPIController creates a default api controller -func NewStoreAPIController(s StoreAPIServicer, opts ...StoreAPIOption) Router { +func NewStoreAPIController(s StoreAPIServicer, opts ...StoreAPIOption) *StoreAPIController { controller := &StoreAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -88,7 +88,7 @@ func (c *StoreAPIController) DeleteOrder(w http.ResponseWriter, r *http.Request) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetInventory - Returns pet inventories by status @@ -100,7 +100,7 @@ func (c *StoreAPIController) GetInventory(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetOrderById - Find purchase order by ID @@ -122,7 +122,7 @@ func (c *StoreAPIController) GetOrderById(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // PlaceOrder - Place an order for a pet @@ -149,5 +149,5 @@ func (c *StoreAPIController) PlaceOrder(w http.ResponseWriter, r *http.Request) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_store_service.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_store_service.go index ee41bf5fdd3b..46671f7a9fd9 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_store_service.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_store_service.go @@ -23,7 +23,7 @@ type StoreAPIService struct { } // NewStoreAPIService creates a default api service -func NewStoreAPIService() StoreAPIServicer { +func NewStoreAPIService() *StoreAPIService { return &StoreAPIService{} } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_user.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_user.go index 269c5445c867..1d28ab73b753 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_user.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_user.go @@ -35,7 +35,7 @@ func WithUserAPIErrorHandler(h ErrorHandler) UserAPIOption { } // NewUserAPIController creates a default api controller -func NewUserAPIController(s UserAPIServicer, opts ...UserAPIOption) Router { +func NewUserAPIController(s UserAPIServicer, opts ...UserAPIOption) *UserAPIController { controller := &UserAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -118,7 +118,7 @@ func (c *UserAPIController) CreateUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // CreateUsersWithArrayInput - Creates list of users with given input array @@ -143,7 +143,7 @@ func (c *UserAPIController) CreateUsersWithArrayInput(w http.ResponseWriter, r * return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // CreateUsersWithListInput - Creates list of users with given input array @@ -168,7 +168,7 @@ func (c *UserAPIController) CreateUsersWithListInput(w http.ResponseWriter, r *h return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // DeleteUser - Delete user @@ -204,7 +204,7 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetUserByName - Get user by user name @@ -221,7 +221,7 @@ func (c *UserAPIController) GetUserByName(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // LoginUser - Logs user into the system @@ -326,7 +326,7 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // LogoutUser - Logs out current logged in user session @@ -338,7 +338,7 @@ func (c *UserAPIController) LogoutUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdateUser - Updated user @@ -370,5 +370,5 @@ func (c *UserAPIController) UpdateUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/api_user_service.go b/samples/openapi3/server/petstore/go/go-petstore/go/api_user_service.go index 35abd4478ede..4be92131dc0b 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/api_user_service.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/api_user_service.go @@ -23,7 +23,7 @@ type UserAPIService struct { } // NewUserAPIService creates a default api service -func NewUserAPIService() UserAPIServicer { +func NewUserAPIService() *UserAPIService { return &UserAPIService{} } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/error.go b/samples/openapi3/server/petstore/go/go-petstore/go/error.go index 82dc66e0ed85..ba23f89b8385 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/error.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/error.go @@ -34,9 +34,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 @@ -54,15 +54,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), map[string][]string{}, w) - } else if _, ok := err.(*RequiredError); ok { - // Handle missing required errors - EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity), map[string][]string{}, w) - } else { - // Handle all other errors - EncodeJSONResponse(err.Error(), &result.Code, result.Headers, w) + _ = EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest), map[string][]string{}, 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), map[string][]string{}, w) + return + } + + // Handle all other errors + _ = EncodeJSONResponse(err.Error(), &result.Code, result.Headers, w) } diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/helpers.go b/samples/openapi3/server/petstore/go/go-petstore/go/helpers.go index 886c0c9a17dd..027954b0c9b9 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/helpers.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/helpers.go @@ -61,7 +61,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/samples/openapi3/server/petstore/go/go-petstore/go/routers.go b/samples/openapi3/server/petstore/go/go-petstore/go/routers.go index ef9200e0a24c..4d662e273c58 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/routers.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/routers.go @@ -50,8 +50,7 @@ func NewRouter(routers ...Router) chi.Router { router.Use(middleware.Logger) for _, api := range routers { for _, route := range api.Routes() { - var handler http.Handler - handler = route.HandlerFunc + var handler http.Handler = route.HandlerFunc router.Method(route.Method, route.Pattern, handler) } } @@ -341,7 +340,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/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Addressable.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Addressable.java index 6721f36254d0..3fc30878a260 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Addressable.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Addressable.java @@ -104,5 +104,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Addressable instance; + + public Builder() { + this(new Addressable()); + } + + protected Builder(Addressable instance) { + this.instance = instance; + } + + protected Builder copyOf(Addressable value) { + this.instance.setHref(value.href); + this.instance.setId(value.id); + return this; + } + + public Addressable.Builder href(String href) { + this.instance.href(href); + return this; + } + + public Addressable.Builder id(String id) { + this.instance.id(id); + return this; + } + + /** + * returns a built Addressable instance. + * + * The builder is not reusable (NullPointerException) + */ + public Addressable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Addressable.Builder builder() { + return new Addressable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Addressable.Builder toBuilder() { + Addressable.Builder builder = new Addressable.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Apple.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Apple.java index 1fc5fa7895a6..00f1544d2601 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Apple.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Apple.java @@ -119,5 +119,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Apple instance; + + public Builder() { + this(new Apple()); + } + + protected Builder(Apple instance) { + this.instance = instance; + } + + protected Builder copyOf(Apple value) { + this.instance.setSeeds(value.seeds); + this.instance.setFruitType(value.fruitType); + return this; + } + + public Apple.Builder seeds(Integer seeds) { + this.instance.seeds(seeds); + return this; + } + + public Apple.Builder fruitType(FruitType fruitType) { + this.instance.fruitType(fruitType); + return this; + } + + /** + * returns a built Apple instance. + * + * The builder is not reusable (NullPointerException) + */ + public Apple build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Apple.Builder builder() { + return new Apple.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Apple.Builder toBuilder() { + Apple.Builder builder = new Apple.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Banana.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Banana.java index f6c34e740259..2887c8a47257 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Banana.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Banana.java @@ -119,5 +119,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Banana instance; + + public Builder() { + this(new Banana()); + } + + protected Builder(Banana instance) { + this.instance = instance; + } + + protected Builder copyOf(Banana value) { + this.instance.setLength(value.length); + this.instance.setFruitType(value.fruitType); + return this; + } + + public Banana.Builder length(Integer length) { + this.instance.length(length); + return this; + } + + public Banana.Builder fruitType(FruitType fruitType) { + this.instance.fruitType(fruitType); + return this; + } + + /** + * returns a built Banana instance. + * + * The builder is not reusable (NullPointerException) + */ + public Banana build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Banana.Builder builder() { + return new Banana.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Banana.Builder toBuilder() { + Banana.Builder builder = new Banana.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java index c9306e8f7f09..519aa0635d16 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java @@ -191,5 +191,108 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private Bar instance; + + public Builder() { + this(new Bar()); + } + + protected Builder(Bar instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Bar value) { + super.copyOf(instance); + this.instance.setId(value.id); + this.instance.setBarPropA(value.barPropA); + this.instance.setFooPropB(value.fooPropB); + this.instance.setFoo(value.foo); + return this; + } + + public Bar.Builder id(String id) { + this.instance.id(id); + return this; + } + + public Bar.Builder barPropA(String barPropA) { + this.instance.barPropA(barPropA); + return this; + } + + public Bar.Builder fooPropB(String fooPropB) { + this.instance.fooPropB(fooPropB); + return this; + } + + public Bar.Builder foo(FooRefOrValue foo) { + this.instance.foo(foo); + return this; + } + + @Override + public Bar.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public Bar.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public Bar.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public Bar.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Bar instance. + * + * The builder is not reusable (NullPointerException) + */ + public Bar build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Bar.Builder builder() { + return new Bar.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Bar.Builder toBuilder() { + Bar.Builder builder = new Bar.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java index 3ed13e8d924d..5b4b4fcebcd4 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java @@ -173,5 +173,108 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private BarCreate instance; + + public Builder() { + this(new BarCreate()); + } + + protected Builder(BarCreate instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(BarCreate value) { + super.copyOf(instance); + this.instance.setBarPropA(value.barPropA); + this.instance.setFooPropB(value.fooPropB); + this.instance.setFoo(value.foo); + return this; + } + + public BarCreate.Builder barPropA(String barPropA) { + this.instance.barPropA(barPropA); + return this; + } + + public BarCreate.Builder fooPropB(String fooPropB) { + this.instance.fooPropB(fooPropB); + return this; + } + + public BarCreate.Builder foo(FooRefOrValue foo) { + this.instance.foo(foo); + return this; + } + + @Override + public BarCreate.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public BarCreate.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public BarCreate.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public BarCreate.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public BarCreate.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built BarCreate instance. + * + * The builder is not reusable (NullPointerException) + */ + public BarCreate build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static BarCreate.Builder builder() { + return new BarCreate.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public BarCreate.Builder toBuilder() { + BarCreate.Builder builder = new BarCreate.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java index 20b4ce977104..86f8668df689 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java @@ -107,5 +107,102 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends EntityRef.Builder { + + private BarRef instance; + + public Builder() { + this(new BarRef()); + } + + protected Builder(BarRef instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(BarRef value) { + super.copyOf(instance); + return this; + } + + @Override + public BarRef.Builder name(String name) { + this.instance.name(name); + return this; + } + + @Override + public BarRef.Builder atReferredType(String atReferredType) { + this.instance.atReferredType(atReferredType); + return this; + } + + @Override + public BarRef.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public BarRef.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public BarRef.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public BarRef.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public BarRef.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built BarRef instance. + * + * The builder is not reusable (NullPointerException) + */ + public BarRef build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static BarRef.Builder builder() { + return new BarRef.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public BarRef.Builder toBuilder() { + BarRef.Builder builder = new BarRef.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java index c83c77d7642c..a407147435a7 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java @@ -203,5 +203,87 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Entity instance; + + public Builder() { + this(new Entity()); + } + + protected Builder(Entity instance) { + this.instance = instance; + } + + protected Builder copyOf(Entity value) { + this.instance.setHref(value.href); + this.instance.setId(value.id); + this.instance.setAtSchemaLocation(value.atSchemaLocation); + this.instance.setAtBaseType(value.atBaseType); + this.instance.setAtType(value.atType); + return this; + } + + public Entity.Builder href(String href) { + this.instance.href(href); + return this; + } + + public Entity.Builder id(String id) { + this.instance.id(id); + return this; + } + + public Entity.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + public Entity.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + public Entity.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Entity instance. + * + * The builder is not reusable (NullPointerException) + */ + public Entity build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Entity.Builder builder() { + return new Entity.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Entity.Builder toBuilder() { + Entity.Builder builder = new Entity.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java index 64656344178a..a9a846bf8848 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java @@ -248,5 +248,99 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private EntityRef instance; + + public Builder() { + this(new EntityRef()); + } + + protected Builder(EntityRef instance) { + this.instance = instance; + } + + protected Builder copyOf(EntityRef value) { + this.instance.setName(value.name); + this.instance.setAtReferredType(value.atReferredType); + this.instance.setHref(value.href); + this.instance.setId(value.id); + this.instance.setAtSchemaLocation(value.atSchemaLocation); + this.instance.setAtBaseType(value.atBaseType); + this.instance.setAtType(value.atType); + return this; + } + + public EntityRef.Builder name(String name) { + this.instance.name(name); + return this; + } + + public EntityRef.Builder atReferredType(String atReferredType) { + this.instance.atReferredType(atReferredType); + return this; + } + + public EntityRef.Builder href(String href) { + this.instance.href(href); + return this; + } + + public EntityRef.Builder id(String id) { + this.instance.id(id); + return this; + } + + public EntityRef.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + public EntityRef.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + public EntityRef.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built EntityRef instance. + * + * The builder is not reusable (NullPointerException) + */ + public EntityRef build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static EntityRef.Builder builder() { + return new EntityRef.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EntityRef.Builder toBuilder() { + EntityRef.Builder builder = new EntityRef.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Extensible.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Extensible.java index e0ba3831c40c..15e64edf1295 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Extensible.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Extensible.java @@ -138,5 +138,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Extensible instance; + + public Builder() { + this(new Extensible()); + } + + protected Builder(Extensible instance) { + this.instance = instance; + } + + protected Builder copyOf(Extensible value) { + this.instance.setAtSchemaLocation(value.atSchemaLocation); + this.instance.setAtBaseType(value.atBaseType); + this.instance.setAtType(value.atType); + return this; + } + + public Extensible.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + public Extensible.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + public Extensible.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Extensible instance. + * + * The builder is not reusable (NullPointerException) + */ + public Extensible build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Extensible.Builder builder() { + return new Extensible.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Extensible.Builder toBuilder() { + Extensible.Builder builder = new Extensible.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java index ab68270f0579..ec7bc261702d 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java @@ -146,5 +146,102 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private Foo instance; + + public Builder() { + this(new Foo()); + } + + protected Builder(Foo instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Foo value) { + super.copyOf(instance); + this.instance.setFooPropA(value.fooPropA); + this.instance.setFooPropB(value.fooPropB); + return this; + } + + public Foo.Builder fooPropA(String fooPropA) { + this.instance.fooPropA(fooPropA); + return this; + } + + public Foo.Builder fooPropB(String fooPropB) { + this.instance.fooPropB(fooPropB); + return this; + } + + @Override + public Foo.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public Foo.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public Foo.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public Foo.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public Foo.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Foo instance. + * + * The builder is not reusable (NullPointerException) + */ + public Foo build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Foo.Builder builder() { + return new Foo.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Foo.Builder toBuilder() { + Foo.Builder builder = new Foo.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java index 2d4ba32fa7db..b87298b8a91b 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java @@ -132,5 +132,108 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends EntityRef.Builder { + + private FooRef instance; + + public Builder() { + this(new FooRef()); + } + + protected Builder(FooRef instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(FooRef value) { + super.copyOf(instance); + this.instance.setFoorefPropA(value.foorefPropA); + return this; + } + + public FooRef.Builder foorefPropA(String foorefPropA) { + this.instance.foorefPropA(foorefPropA); + return this; + } + + @Override + public FooRef.Builder name(String name) { + this.instance.name(name); + return this; + } + + @Override + public FooRef.Builder atReferredType(String atReferredType) { + this.instance.atReferredType(atReferredType); + return this; + } + + @Override + public FooRef.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public FooRef.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public FooRef.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public FooRef.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public FooRef.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built FooRef instance. + * + * The builder is not reusable (NullPointerException) + */ + public FooRef build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FooRef.Builder builder() { + return new FooRef.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FooRef.Builder toBuilder() { + FooRef.Builder builder = new FooRef.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java index 7ae080eb44c7..e2b77398fabc 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java @@ -122,5 +122,96 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private Pasta instance; + + public Builder() { + this(new Pasta()); + } + + protected Builder(Pasta instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Pasta value) { + super.copyOf(instance); + this.instance.setVendor(value.vendor); + return this; + } + + public Pasta.Builder vendor(String vendor) { + this.instance.vendor(vendor); + return this; + } + + @Override + public Pasta.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public Pasta.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public Pasta.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public Pasta.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public Pasta.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Pasta instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pasta build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pasta.Builder builder() { + return new Pasta.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pasta.Builder toBuilder() { + Pasta.Builder builder = new Pasta.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java index b179761095dc..eead5daa9efa 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java @@ -131,5 +131,96 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private Pizza instance; + + public Builder() { + this(new Pizza()); + } + + protected Builder(Pizza instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Pizza value) { + super.copyOf(instance); + this.instance.setPizzaSize(value.pizzaSize); + return this; + } + + public Pizza.Builder pizzaSize(BigDecimal pizzaSize) { + this.instance.pizzaSize(pizzaSize); + return this; + } + + @Override + public Pizza.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public Pizza.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public Pizza.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public Pizza.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public Pizza.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Pizza instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pizza build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pizza.Builder builder() { + return new Pizza.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pizza.Builder toBuilder() { + Pizza.Builder builder = new Pizza.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java index 18ced1b22e59..9225b04669e9 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java @@ -128,5 +128,102 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Pizza.Builder { + + private PizzaSpeziale instance; + + public Builder() { + this(new PizzaSpeziale()); + } + + protected Builder(PizzaSpeziale instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(PizzaSpeziale value) { + super.copyOf(instance); + this.instance.setToppings(value.toppings); + return this; + } + + public PizzaSpeziale.Builder toppings(String toppings) { + this.instance.toppings(toppings); + return this; + } + + @Override + public PizzaSpeziale.Builder pizzaSize(BigDecimal pizzaSize) { + this.instance.pizzaSize(pizzaSize); + return this; + } + + @Override + public PizzaSpeziale.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public PizzaSpeziale.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public PizzaSpeziale.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public PizzaSpeziale.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public PizzaSpeziale.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built PizzaSpeziale instance. + * + * The builder is not reusable (NullPointerException) + */ + public PizzaSpeziale build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static PizzaSpeziale.Builder builder() { + return new PizzaSpeziale.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public PizzaSpeziale.Builder toBuilder() { + PizzaSpeziale.Builder builder = new PizzaSpeziale.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Category.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Category.java index 10be3581d48d..c75ecd5a1afc 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Category.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Category.java @@ -33,6 +33,10 @@ public class Category { private String name; + public Category() { + super(); + } + /** * Constructor with all args parameters */ @@ -121,5 +125,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Category instance; + + public Builder() { + this(new Category()); + } + + protected Builder(Category instance) { + this.instance = instance; + } + + protected Builder copyOf(Category value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Category.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Category.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Category instance. + * + * The builder is not reusable (NullPointerException) + */ + public Category build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Category.Builder builder() { + return new Category.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Category.Builder toBuilder() { + Category.Builder builder = new Category.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/ModelApiResponse.java index c791e9163df3..6d1560586aa3 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -37,6 +37,10 @@ public class ModelApiResponse { private String message; + public ModelApiResponse() { + super(); + } + /** * Constructor with all args parameters */ @@ -149,5 +153,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ModelApiResponse instance; + + public Builder() { + this(new ModelApiResponse()); + } + + protected Builder(ModelApiResponse instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelApiResponse value) { + this.instance.setCode(value.code); + this.instance.setType(value.type); + this.instance.setMessage(value.message); + return this; + } + + public ModelApiResponse.Builder code(Integer code) { + this.instance.code(code); + return this; + } + + public ModelApiResponse.Builder type(String type) { + this.instance.type(type); + return this; + } + + public ModelApiResponse.Builder message(String message) { + this.instance.message(message); + return this; + } + + /** + * returns a built ModelApiResponse instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelApiResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelApiResponse.Builder builder() { + return new ModelApiResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelApiResponse.Builder toBuilder() { + ModelApiResponse.Builder builder = new ModelApiResponse.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Order.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Order.java index 2a4bd20e5b20..799499324756 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Order.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Order.java @@ -82,6 +82,10 @@ public static StatusEnum fromValue(String value) { private Boolean complete = false; + public Order() { + super(); + } + /** * Constructor with all args parameters */ @@ -266,5 +270,93 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Order instance; + + public Builder() { + this(new Order()); + } + + protected Builder(Order instance) { + this.instance = instance; + } + + protected Builder copyOf(Order value) { + this.instance.setId(value.id); + this.instance.setPetId(value.petId); + this.instance.setQuantity(value.quantity); + this.instance.setShipDate(value.shipDate); + this.instance.setStatus(value.status); + this.instance.setComplete(value.complete); + return this; + } + + public Order.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Order.Builder petId(Long petId) { + this.instance.petId(petId); + return this; + } + + public Order.Builder quantity(Integer quantity) { + this.instance.quantity(quantity); + return this; + } + + public Order.Builder shipDate(OffsetDateTime shipDate) { + this.instance.shipDate(shipDate); + return this; + } + + public Order.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + + public Order.Builder complete(Boolean complete) { + this.instance.complete(complete); + return this; + } + + /** + * returns a built Order instance. + * + * The builder is not reusable (NullPointerException) + */ + public Order build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Order.Builder builder() { + return new Order.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Order.Builder toBuilder() { + Order.Builder builder = new Order.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Pet.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Pet.java index 911de2422fbb..73e9bbec8c9e 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Pet.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Pet.java @@ -305,5 +305,95 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Pet instance; + + public Builder() { + this(new Pet()); + } + + protected Builder(Pet instance) { + this.instance = instance; + } + + protected Builder copyOf(Pet value) { + this.instance.setId(value.id); + this.instance.setCategory(value.category); + this.instance.setName(value.name); + this.instance.setPhotoUrls(value.photoUrls); + this.instance.setTags(value.tags); + this.instance.setStatus(value.status); + return this; + } + + public Pet.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Pet.Builder category(Category category) { + this.instance.category(category); + return this; + } + + public Pet.Builder name(String name) { + this.instance.name(name); + return this; + } + + public Pet.Builder photoUrls(List photoUrls) { + this.instance.photoUrls(photoUrls); + return this; + } + + public Pet.Builder tags(List<@Valid Tag> tags) { + this.instance.tags(tags); + return this; + } + + @Deprecated + public Pet.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + @Deprecated + + /** + * returns a built Pet instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pet.Builder builder() { + return new Pet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pet.Builder toBuilder() { + Pet.Builder builder = new Pet.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Tag.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Tag.java index 2124198f203f..dbd8c2e97cad 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Tag.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Tag.java @@ -33,6 +33,10 @@ public class Tag { private String name; + public Tag() { + super(); + } + /** * Constructor with all args parameters */ @@ -121,5 +125,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Tag instance; + + public Builder() { + this(new Tag()); + } + + protected Builder(Tag instance) { + this.instance = instance; + } + + protected Builder copyOf(Tag value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Tag.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Tag.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Tag instance. + * + * The builder is not reusable (NullPointerException) + */ + public Tag build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Tag.Builder builder() { + return new Tag.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Tag.Builder toBuilder() { + Tag.Builder builder = new Tag.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/User.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/User.java index bc06bb7f2a89..0d3453e42ab1 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/User.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/User.java @@ -45,6 +45,10 @@ public class User { private Integer userStatus; + public User() { + super(); + } + /** * Constructor with all args parameters */ @@ -277,5 +281,105 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private User instance; + + public Builder() { + this(new User()); + } + + protected Builder(User instance) { + this.instance = instance; + } + + protected Builder copyOf(User value) { + this.instance.setId(value.id); + this.instance.setUsername(value.username); + this.instance.setFirstName(value.firstName); + this.instance.setLastName(value.lastName); + this.instance.setEmail(value.email); + this.instance.setPassword(value.password); + this.instance.setPhone(value.phone); + this.instance.setUserStatus(value.userStatus); + return this; + } + + public User.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public User.Builder username(String username) { + this.instance.username(username); + return this; + } + + public User.Builder firstName(String firstName) { + this.instance.firstName(firstName); + return this; + } + + public User.Builder lastName(String lastName) { + this.instance.lastName(lastName); + return this; + } + + public User.Builder email(String email) { + this.instance.email(email); + return this; + } + + public User.Builder password(String password) { + this.instance.password(password); + return this; + } + + public User.Builder phone(String phone) { + this.instance.phone(phone); + return this; + } + + public User.Builder userStatus(Integer userStatus) { + this.instance.userStatus(userStatus); + return this; + } + + /** + * returns a built User instance. + * + * The builder is not reusable (NullPointerException) + */ + public User build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static User.Builder builder() { + return new User.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public User.Builder toBuilder() { + User.Builder builder = new User.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/others/go-server/no-body-path-params/go/api_body.go b/samples/server/others/go-server/no-body-path-params/go/api_body.go index 6830786d1ba4..02b5ad81f38c 100644 --- a/samples/server/others/go-server/no-body-path-params/go/api_body.go +++ b/samples/server/others/go-server/no-body-path-params/go/api_body.go @@ -33,7 +33,7 @@ func WithBodyAPIErrorHandler(h ErrorHandler) BodyAPIOption { } // NewBodyAPIController creates a default api controller -func NewBodyAPIController(s BodyAPIServicer, opts ...BodyAPIOption) Router { +func NewBodyAPIController(s BodyAPIServicer, opts ...BodyAPIOption) *BodyAPIController { controller := &BodyAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -81,5 +81,5 @@ func (c *BodyAPIController) Body(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/others/go-server/no-body-path-params/go/api_body_service.go b/samples/server/others/go-server/no-body-path-params/go/api_body_service.go index cd0de685ae4b..2f0c80829350 100644 --- a/samples/server/others/go-server/no-body-path-params/go/api_body_service.go +++ b/samples/server/others/go-server/no-body-path-params/go/api_body_service.go @@ -23,7 +23,7 @@ type BodyAPIService struct { } // NewBodyAPIService creates a default api service -func NewBodyAPIService() BodyAPIServicer { +func NewBodyAPIService() *BodyAPIService { return &BodyAPIService{} } diff --git a/samples/server/others/go-server/no-body-path-params/go/api_both.go b/samples/server/others/go-server/no-body-path-params/go/api_both.go index 5d5d2d3cad56..c100791a92d9 100644 --- a/samples/server/others/go-server/no-body-path-params/go/api_both.go +++ b/samples/server/others/go-server/no-body-path-params/go/api_both.go @@ -35,7 +35,7 @@ func WithBothAPIErrorHandler(h ErrorHandler) BothAPIOption { } // NewBothAPIController creates a default api controller -func NewBothAPIController(s BothAPIServicer, opts ...BothAPIOption) Router { +func NewBothAPIController(s BothAPIServicer, opts ...BothAPIOption) *BothAPIController { controller := &BothAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -89,5 +89,5 @@ func (c *BothAPIController) Both(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/others/go-server/no-body-path-params/go/api_both_service.go b/samples/server/others/go-server/no-body-path-params/go/api_both_service.go index 6ba8112cbb81..bb9b26a38628 100644 --- a/samples/server/others/go-server/no-body-path-params/go/api_both_service.go +++ b/samples/server/others/go-server/no-body-path-params/go/api_both_service.go @@ -23,7 +23,7 @@ type BothAPIService struct { } // NewBothAPIService creates a default api service -func NewBothAPIService() BothAPIServicer { +func NewBothAPIService() *BothAPIService { return &BothAPIService{} } diff --git a/samples/server/others/go-server/no-body-path-params/go/api_none.go b/samples/server/others/go-server/no-body-path-params/go/api_none.go index be2813a2871d..54bbc5ad85d4 100644 --- a/samples/server/others/go-server/no-body-path-params/go/api_none.go +++ b/samples/server/others/go-server/no-body-path-params/go/api_none.go @@ -32,7 +32,7 @@ func WithNoneAPIErrorHandler(h ErrorHandler) NoneAPIOption { } // NewNoneAPIController creates a default api controller -func NewNoneAPIController(s NoneAPIServicer, opts ...NoneAPIOption) Router { +func NewNoneAPIController(s NoneAPIServicer, opts ...NoneAPIOption) *NoneAPIController { controller := &NoneAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -65,5 +65,5 @@ func (c *NoneAPIController) One(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/others/go-server/no-body-path-params/go/api_none_service.go b/samples/server/others/go-server/no-body-path-params/go/api_none_service.go index 80b0b25e75ea..b259fe8198fe 100644 --- a/samples/server/others/go-server/no-body-path-params/go/api_none_service.go +++ b/samples/server/others/go-server/no-body-path-params/go/api_none_service.go @@ -23,7 +23,7 @@ type NoneAPIService struct { } // NewNoneAPIService creates a default api service -func NewNoneAPIService() NoneAPIServicer { +func NewNoneAPIService() *NoneAPIService { return &NoneAPIService{} } diff --git a/samples/server/others/go-server/no-body-path-params/go/api_path.go b/samples/server/others/go-server/no-body-path-params/go/api_path.go index f361bf7ac1f0..beb6dbd6e7a3 100644 --- a/samples/server/others/go-server/no-body-path-params/go/api_path.go +++ b/samples/server/others/go-server/no-body-path-params/go/api_path.go @@ -34,7 +34,7 @@ func WithPathAPIErrorHandler(h ErrorHandler) PathAPIOption { } // NewPathAPIController creates a default api controller -func NewPathAPIController(s PathAPIServicer, opts ...PathAPIOption) Router { +func NewPathAPIController(s PathAPIServicer, opts ...PathAPIOption) *PathAPIController { controller := &PathAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -73,5 +73,5 @@ func (c *PathAPIController) Path(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/others/go-server/no-body-path-params/go/api_path_service.go b/samples/server/others/go-server/no-body-path-params/go/api_path_service.go index 611c5c38a16a..706e97805015 100644 --- a/samples/server/others/go-server/no-body-path-params/go/api_path_service.go +++ b/samples/server/others/go-server/no-body-path-params/go/api_path_service.go @@ -23,7 +23,7 @@ type PathAPIService struct { } // NewPathAPIService creates a default api service -func NewPathAPIService() PathAPIServicer { +func NewPathAPIService() *PathAPIService { return &PathAPIService{} } diff --git a/samples/server/others/go-server/no-body-path-params/go/error.go b/samples/server/others/go-server/no-body-path-params/go/error.go index 2c80ab1328ba..6da8e9adacba 100644 --- a/samples/server/others/go-server/no-body-path-params/go/error.go +++ b/samples/server/others/go-server/no-body-path-params/go/error.go @@ -34,9 +34,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 @@ -54,15 +54,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), map[string][]string{}, w) - } else if _, ok := err.(*RequiredError); ok { - // Handle missing required errors - EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity), map[string][]string{}, w) - } else { - // Handle all other errors - EncodeJSONResponse(err.Error(), &result.Code, result.Headers, w) + _ = EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest), map[string][]string{}, 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), map[string][]string{}, w) + return + } + + // Handle all other errors + _ = EncodeJSONResponse(err.Error(), &result.Code, result.Headers, w) } diff --git a/samples/server/others/go-server/no-body-path-params/go/helpers.go b/samples/server/others/go-server/no-body-path-params/go/helpers.go index 4a3079c45b5c..9c9664853e65 100644 --- a/samples/server/others/go-server/no-body-path-params/go/helpers.go +++ b/samples/server/others/go-server/no-body-path-params/go/helpers.go @@ -61,7 +61,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/samples/server/others/go-server/no-body-path-params/go/routers.go b/samples/server/others/go-server/no-body-path-params/go/routers.go index 536b14449feb..249c28f9e3bb 100644 --- a/samples/server/others/go-server/no-body-path-params/go/routers.go +++ b/samples/server/others/go-server/no-body-path-params/go/routers.go @@ -48,8 +48,7 @@ func NewRouter(routers ...Router) *mux.Router { router := mux.NewRouter().StrictSlash(true) for _, api := range routers { for name, route := range api.Routes() { - var handler http.Handler - handler = route.HandlerFunc + var handler http.Handler = route.HandlerFunc handler = Logger(handler, name) router. @@ -345,7 +344,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/samples/client/petstore/kotlin-spring-cloud/.openapi-generator-ignore b/samples/server/petstore/cpp-pistache-everything/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/.openapi-generator-ignore rename to samples/server/petstore/cpp-pistache-everything/.openapi-generator-ignore diff --git a/samples/server/petstore/cpp-pistache-everything/.openapi-generator/FILES b/samples/server/petstore/cpp-pistache-everything/.openapi-generator/FILES new file mode 100644 index 000000000000..c0724b40461a --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/.openapi-generator/FILES @@ -0,0 +1,32 @@ +CMakeLists.txt +README.md +api/ApiBase.h +api/PetApi.cpp +api/PetApi.h +api/StoreApi.cpp +api/StoreApi.h +api/UserApi.cpp +api/UserApi.h +impl/PetApiImpl.cpp +impl/PetApiImpl.h +impl/StoreApiImpl.cpp +impl/StoreApiImpl.h +impl/UserApiImpl.cpp +impl/UserApiImpl.h +main-api-server.cpp +model/ApiResponse.cpp +model/ApiResponse.h +model/Category.cpp +model/Category.h +model/Helpers.cpp +model/Helpers.h +model/Order.cpp +model/Order.h +model/Pet.cpp +model/Pet.h +model/Pet_bestFriends.cpp +model/Pet_bestFriends.h +model/Tag.cpp +model/Tag.h +model/User.cpp +model/User.h diff --git a/samples/client/petstore/kotlin-spring-cloud/.openapi-generator/VERSION b/samples/server/petstore/cpp-pistache-everything/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/.openapi-generator/VERSION rename to samples/server/petstore/cpp-pistache-everything/.openapi-generator/VERSION diff --git a/samples/server/petstore/cpp-pistache-everything/CMakeLists.txt b/samples/server/petstore/cpp-pistache-everything/CMakeLists.txt new file mode 100644 index 000000000000..23269deb0ff2 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required (VERSION 3.2) + +project(api-server) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pg -g3" ) + +include(ExternalProject) + +set(EXTERNAL_INSTALL_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/external) + +ExternalProject_Add(PISTACHE + GIT_REPOSITORY https://github.com/pistacheio/pistache.git + BUILD_IN_SOURCE true + INSTALL_COMMAND meson setup build --prefix=${EXTERNAL_INSTALL_LOCATION} --libdir=lib && meson install -C build +) + +ExternalProject_Add(NLOHMANN + GIT_REPOSITORY https://github.com/nlohmann/json.git + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DJSON_BuildTests=OFF +) + +include_directories(${EXTERNAL_INSTALL_LOCATION}/include) +link_directories(${EXTERNAL_INSTALL_LOCATION}/lib) + +include_directories(model) +include_directories(api) +include_directories(impl) + +file(GLOB SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/api/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/impl/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/model/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) + +add_executable(${PROJECT_NAME} ${SRCS} ) +add_dependencies(${PROJECT_NAME} PISTACHE NLOHMANN) +target_link_libraries(${PROJECT_NAME} pistache pthread) diff --git a/samples/server/petstore/cpp-pistache-everything/README.md b/samples/server/petstore/cpp-pistache-everything/README.md new file mode 100644 index 000000000000..7d4392fde7e9 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/README.md @@ -0,0 +1,48 @@ +# REST API Server for OpenAPI Petstore + +## Overview +This API Server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +It uses the [Pistache](https://github.com/oktal/pistache) Framework. + +## Files organization +The Pistache C++ REST server generator creates three folders: +- `api`: This folder contains the handlers for each method specified in the OpenAPI definition. Every handler extracts +the path and body parameters (if any) from the requests and tries to parse and possibly validate them. +Once this step is completed, the main API class calls the corresponding abstract method that should be implemented +by the developer (a basic implementation is provided under the `impl` folder) +- `impl`: As written above, the implementation folder contains, for each API, the corresponding implementation class, +which extends the main API class and implements the abstract methods. +Every method receives the path and body parameters as constant reference variables and a reference to the response +object, that should be filled with the right response and sent at the end of the method with the command: +response.send(returnCode, responseBody, [mimeType]) +- `model`: This folder contains the corresponding class for every object schema found in the OpenAPI specification. + +The main folder contains also a file with a main that can be used to start the server. +Of course, is you should customize this file based on your needs + +## Installation +First of all, you need to download and install the libraries listed [here](#libraries-required). + +Once the libraries are installed, in order to compile and run the server please follow the steps below: +```bash +mkdir build +cd build +cmake .. +make +``` + +Once compiled run the server: + +```bash +cd build +./api-server +``` + +## Libraries required +- [pistache](http://pistache.io/quickstart) +- [JSON for Modern C++](https://github.com/nlohmann/json/#integration): Please download the `json.hpp` file and +put it under the model/nlohmann folder + +## Namespaces +org.openapitools.server.api +org.openapitools.server.model diff --git a/samples/server/petstore/cpp-pistache-everything/api/ApiBase.h b/samples/server/petstore/cpp-pistache-everything/api/ApiBase.h new file mode 100644 index 000000000000..5911d87c2d4b --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/api/ApiBase.h @@ -0,0 +1,39 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * ApiBase.h + * + * Generalization of the Api classes + */ + +#ifndef ApiBase_H_ +#define ApiBase_H_ + +#include +#include + +namespace org::openapitools::server::api +{ + +class ApiBase { +public: + explicit ApiBase(const std::shared_ptr& rtr) : router(rtr) {}; + virtual ~ApiBase() = default; + virtual void init() = 0; + +protected: + const std::shared_ptr router; +}; + +} // namespace org::openapitools::server::api + +#endif /* ApiBase_H_ */ diff --git a/samples/server/petstore/cpp-pistache-everything/api/PetApi.cpp b/samples/server/petstore/cpp-pistache-everything/api/PetApi.cpp new file mode 100644 index 000000000000..0267ad305ca5 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/api/PetApi.cpp @@ -0,0 +1,284 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +#include "PetApi.h" +#include "Helpers.h" + +namespace org::openapitools::server::api +{ + +using namespace org::openapitools::server::helpers; +using namespace org::openapitools::server::model; + +const std::string PetApi::base = "/v2"; + +PetApi::PetApi(const std::shared_ptr& rtr) + : ApiBase(rtr) +{ +} + +void PetApi::init() { + setupRoutes(); +} + +void PetApi::setupRoutes() { + using namespace Pistache::Rest; + + Routes::Post(*router, base + "/pet", Routes::bind(&PetApi::add_pet_handler, this)); + Routes::Delete(*router, base + "/pet/:petId", Routes::bind(&PetApi::delete_pet_handler, this)); + Routes::Get(*router, base + "/pet/findByStatus", Routes::bind(&PetApi::find_pets_by_status_handler, this)); + Routes::Get(*router, base + "/pet/findByTags", Routes::bind(&PetApi::find_pets_by_tags_handler, this)); + Routes::Get(*router, base + "/pet/:petId", Routes::bind(&PetApi::get_pet_by_id_handler, this)); + Routes::Put(*router, base + "/pet", Routes::bind(&PetApi::update_pet_handler, this)); + Routes::Post(*router, base + "/pet/:petId", Routes::bind(&PetApi::update_pet_with_form_handler, this)); + Routes::Post(*router, base + "/pet/:petId/uploadImage", Routes::bind(&PetApi::upload_file_handler, this)); + + // Default handler, called when a route is not found + router->addCustomHandler(Routes::bind(&PetApi::pet_api_default_handler, this)); +} + +std::pair PetApi::handleParsingException(const std::exception& ex) const noexcept +{ + try { + throw; + } catch (nlohmann::detail::exception &e) { + return std::make_pair(Pistache::Http::Code::Bad_Request, e.what()); + } catch (org::openapitools::server::helpers::ValidationException &e) { + return std::make_pair(Pistache::Http::Code::Bad_Request, e.what()); + } catch (std::exception &e) { + return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what()); + } +} + +std::pair PetApi::handleOperationException(const std::exception& ex) const noexcept +{ + return std::make_pair(Pistache::Http::Code::Internal_Server_Error, ex.what()); +} + +void PetApi::add_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the body param + + Pet pet; + + try { + nlohmann::json::parse(request.body()).get_to(pet); + pet.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->add_pet(pet, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void PetApi::delete_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + // Getting the path params + auto petId = request.param(":petId").as(); + + // Getting the header params + auto apiKey = request.headers().tryGetRaw("api_key"); + + try { + this->delete_pet(petId, apiKey, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void PetApi::find_pets_by_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the query params + auto statusQuery = request.query().get("status"); + std::optional> status; + if(statusQuery.has_value()){ + std::vector valueQuery_instance; + if(fromStringValue(statusQuery.value(), valueQuery_instance)){ + status = valueQuery_instance; + } + } + + try { + this->find_pets_by_status(status, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void PetApi::find_pets_by_tags_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the query params + auto tagsQuery = request.query().get("tags"); + std::optional> tags; + if(tagsQuery.has_value()){ + std::vector valueQuery_instance; + if(fromStringValue(tagsQuery.value(), valueQuery_instance)){ + tags = valueQuery_instance; + } + } + + try { + this->find_pets_by_tags(tags, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void PetApi::get_pet_by_id_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + // Getting the path params + auto petId = request.param(":petId").as(); + + try { + this->get_pet_by_id(petId, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void PetApi::update_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the body param + + Pet pet; + + try { + nlohmann::json::parse(request.body()).get_to(pet); + pet.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->update_pet(pet, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void PetApi::update_pet_with_form_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + try { + this->update_pet_with_form(request, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void PetApi::upload_file_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + try { + this->upload_file(request, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} + +void PetApi::pet_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist"); +} + +} // namespace org::openapitools::server::api + diff --git a/samples/server/petstore/cpp-pistache-everything/api/PetApi.h b/samples/server/petstore/cpp-pistache-everything/api/PetApi.h new file mode 100644 index 000000000000..5d2d3bc00cbd --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/api/PetApi.h @@ -0,0 +1,143 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * PetApi.h + * + * + */ + +#ifndef PetApi_H_ +#define PetApi_H_ + + +#include "ApiBase.h" + +#include +#include +#include + +#include +#include + +#include "ApiResponse.h" +#include "Pet.h" +#include +#include + +namespace org::openapitools::server::api +{ + +class PetApi : public ApiBase { +public: + explicit PetApi(const std::shared_ptr& rtr); + ~PetApi() override = default; + void init() override; + + static const std::string base; + +private: + void setupRoutes(); + + void add_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void delete_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void find_pets_by_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void find_pets_by_tags_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void get_pet_by_id_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void update_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void update_pet_with_form_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void upload_file_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void pet_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + + /// + /// Helper function to handle unexpected Exceptions during Parameter parsing and validation. + /// May be overridden to return custom error formats. This is called inside a catch block. + /// Important: When overriding, do not call `throw ex;`, but instead use `throw;`. + /// + virtual std::pair handleParsingException(const std::exception& ex) const noexcept; + + /// + /// Helper function to handle unexpected Exceptions during processing of the request in handler functions. + /// May be overridden to return custom error formats. This is called inside a catch block. + /// Important: When overriding, do not call `throw ex;`, but instead use `throw;`. + /// + virtual std::pair handleOperationException(const std::exception& ex) const noexcept; + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Pet object that needs to be added to the store + virtual void add_pet(const org::openapitools::server::model::Pet &pet, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Deletes a pet + /// + /// + /// + /// + /// Pet id to delete + /// (optional, default to "") + virtual void delete_pet(const int64_t &petId, const std::optional &apiKey, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + virtual void find_pets_by_status(const std::optional> &status, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + virtual void find_pets_by_tags(const std::optional> &tags, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// ID of pet to return + virtual void get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Update an existing pet + /// + /// + /// + /// + /// Pet object that needs to be added to the store + virtual void update_pet(const org::openapitools::server::model::Pet &pet, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + virtual void update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0; + /// + /// uploads an image + /// + /// + /// + /// + virtual void upload_file(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0; + +}; + +} // namespace org::openapitools::server::api + +#endif /* PetApi_H_ */ + diff --git a/samples/server/petstore/cpp-pistache-everything/api/StoreApi.cpp b/samples/server/petstore/cpp-pistache-everything/api/StoreApi.cpp new file mode 100644 index 000000000000..522313849b2b --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/api/StoreApi.cpp @@ -0,0 +1,166 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +#include "StoreApi.h" +#include "Helpers.h" + +namespace org::openapitools::server::api +{ + +using namespace org::openapitools::server::helpers; +using namespace org::openapitools::server::model; + +const std::string StoreApi::base = "/v2"; + +StoreApi::StoreApi(const std::shared_ptr& rtr) + : ApiBase(rtr) +{ +} + +void StoreApi::init() { + setupRoutes(); +} + +void StoreApi::setupRoutes() { + using namespace Pistache::Rest; + + Routes::Delete(*router, base + "/store/order/:orderId", Routes::bind(&StoreApi::delete_order_handler, this)); + Routes::Get(*router, base + "/store/inventory", Routes::bind(&StoreApi::get_inventory_handler, this)); + Routes::Get(*router, base + "/store/order/:orderId", Routes::bind(&StoreApi::get_order_by_id_handler, this)); + Routes::Post(*router, base + "/store/order", Routes::bind(&StoreApi::place_order_handler, this)); + + // Default handler, called when a route is not found + router->addCustomHandler(Routes::bind(&StoreApi::store_api_default_handler, this)); +} + +std::pair StoreApi::handleParsingException(const std::exception& ex) const noexcept +{ + try { + throw; + } catch (nlohmann::detail::exception &e) { + return std::make_pair(Pistache::Http::Code::Bad_Request, e.what()); + } catch (org::openapitools::server::helpers::ValidationException &e) { + return std::make_pair(Pistache::Http::Code::Bad_Request, e.what()); + } catch (std::exception &e) { + return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what()); + } +} + +std::pair StoreApi::handleOperationException(const std::exception& ex) const noexcept +{ + return std::make_pair(Pistache::Http::Code::Internal_Server_Error, ex.what()); +} + +void StoreApi::delete_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + // Getting the path params + auto orderId = request.param(":orderId").as(); + + try { + this->delete_order(orderId, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void StoreApi::get_inventory_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + try { + + + try { + this->get_inventory(response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void StoreApi::get_order_by_id_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + // Getting the path params + auto orderId = request.param(":orderId").as(); + + try { + this->get_order_by_id(orderId, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void StoreApi::place_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the body param + + Order order; + + try { + nlohmann::json::parse(request.body()).get_to(order); + order.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->place_order(order, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} + +void StoreApi::store_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist"); +} + +} // namespace org::openapitools::server::api + diff --git a/samples/server/petstore/cpp-pistache-everything/api/StoreApi.h b/samples/server/petstore/cpp-pistache-everything/api/StoreApi.h new file mode 100644 index 000000000000..69c490d70141 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/api/StoreApi.h @@ -0,0 +1,106 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * StoreApi.h + * + * + */ + +#ifndef StoreApi_H_ +#define StoreApi_H_ + + +#include "ApiBase.h" + +#include +#include +#include + +#include +#include + +#include "Order.h" +#include +#include + +namespace org::openapitools::server::api +{ + +class StoreApi : public ApiBase { +public: + explicit StoreApi(const std::shared_ptr& rtr); + ~StoreApi() override = default; + void init() override; + + static const std::string base; + +private: + void setupRoutes(); + + void delete_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void get_inventory_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void get_order_by_id_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void place_order_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void store_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + + /// + /// Helper function to handle unexpected Exceptions during Parameter parsing and validation. + /// May be overridden to return custom error formats. This is called inside a catch block. + /// Important: When overriding, do not call `throw ex;`, but instead use `throw;`. + /// + virtual std::pair handleParsingException(const std::exception& ex) const noexcept; + + /// + /// Helper function to handle unexpected Exceptions during processing of the request in handler functions. + /// May be overridden to return custom error formats. This is called inside a catch block. + /// Important: When overriding, do not call `throw ex;`, but instead use `throw;`. + /// + virtual std::pair handleOperationException(const std::exception& ex) const noexcept; + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + virtual void delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + virtual void get_inventory(Pistache::Http::ResponseWriter &response) = 0; + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + virtual void get_order_by_id(const int64_t &orderId, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Place an order for a pet + /// + /// + /// + /// + /// order placed for purchasing the pet + virtual void place_order(const org::openapitools::server::model::Order &order, Pistache::Http::ResponseWriter &response) = 0; + +}; + +} // namespace org::openapitools::server::api + +#endif /* StoreApi_H_ */ + diff --git a/samples/server/petstore/cpp-pistache-everything/api/UserApi.cpp b/samples/server/petstore/cpp-pistache-everything/api/UserApi.cpp new file mode 100644 index 000000000000..92b26089edaf --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/api/UserApi.cpp @@ -0,0 +1,309 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +#include "UserApi.h" +#include "Helpers.h" + +namespace org::openapitools::server::api +{ + +using namespace org::openapitools::server::helpers; +using namespace org::openapitools::server::model; + +const std::string UserApi::base = "/v2"; + +UserApi::UserApi(const std::shared_ptr& rtr) + : ApiBase(rtr) +{ +} + +void UserApi::init() { + setupRoutes(); +} + +void UserApi::setupRoutes() { + using namespace Pistache::Rest; + + Routes::Post(*router, base + "/user", Routes::bind(&UserApi::create_user_handler, this)); + Routes::Post(*router, base + "/user/createWithArray", Routes::bind(&UserApi::create_users_with_array_input_handler, this)); + Routes::Post(*router, base + "/user/createWithList", Routes::bind(&UserApi::create_users_with_list_input_handler, this)); + Routes::Delete(*router, base + "/user/:username", Routes::bind(&UserApi::delete_user_handler, this)); + Routes::Get(*router, base + "/user/:username", Routes::bind(&UserApi::get_user_by_name_handler, this)); + Routes::Get(*router, base + "/user/login", Routes::bind(&UserApi::login_user_handler, this)); + Routes::Get(*router, base + "/user/logout", Routes::bind(&UserApi::logout_user_handler, this)); + Routes::Put(*router, base + "/user/:username", Routes::bind(&UserApi::update_user_handler, this)); + + // Default handler, called when a route is not found + router->addCustomHandler(Routes::bind(&UserApi::user_api_default_handler, this)); +} + +std::pair UserApi::handleParsingException(const std::exception& ex) const noexcept +{ + try { + throw; + } catch (nlohmann::detail::exception &e) { + return std::make_pair(Pistache::Http::Code::Bad_Request, e.what()); + } catch (org::openapitools::server::helpers::ValidationException &e) { + return std::make_pair(Pistache::Http::Code::Bad_Request, e.what()); + } catch (std::exception &e) { + return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what()); + } +} + +std::pair UserApi::handleOperationException(const std::exception& ex) const noexcept +{ + return std::make_pair(Pistache::Http::Code::Internal_Server_Error, ex.what()); +} + +void UserApi::create_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the body param + + User user; + + try { + nlohmann::json::parse(request.body()).get_to(user); + user.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->create_user(user, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void UserApi::create_users_with_array_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the body param + std::vector user; + + try { + nlohmann::json::parse(request.body()).get_to(user); + for (const auto& validationParam : user) + validationParam.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->create_users_with_array_input(user, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void UserApi::create_users_with_list_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the body param + std::vector user; + + try { + nlohmann::json::parse(request.body()).get_to(user); + for (const auto& validationParam : user) + validationParam.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->create_users_with_list_input(user, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void UserApi::delete_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + // Getting the path params + auto username = request.param(":username").as(); + + try { + this->delete_user(username, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void UserApi::get_user_by_name_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + // Getting the path params + auto username = request.param(":username").as(); + + try { + this->get_user_by_name(username, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void UserApi::login_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the query params + auto usernameQuery = request.query().get("username"); + std::optional username; + if(usernameQuery.has_value()){ + std::string valueQuery_instance; + if(fromStringValue(usernameQuery.value(), valueQuery_instance)){ + username = valueQuery_instance; + } + } + auto passwordQuery = request.query().get("password"); + std::optional password; + if(passwordQuery.has_value()){ + std::string valueQuery_instance; + if(fromStringValue(passwordQuery.value(), valueQuery_instance)){ + password = valueQuery_instance; + } + } + + try { + this->login_user(username, password, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void UserApi::logout_user_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + try { + + + try { + this->logout_user(response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void UserApi::update_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + // Getting the path params + auto username = request.param(":username").as(); + + // Getting the body param + + User user; + + try { + nlohmann::json::parse(request.body()).get_to(user); + user.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->update_user(username, user, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} + +void UserApi::user_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist"); +} + +} // namespace org::openapitools::server::api + diff --git a/samples/server/petstore/cpp-pistache-everything/api/UserApi.h b/samples/server/petstore/cpp-pistache-everything/api/UserApi.h new file mode 100644 index 000000000000..8ca97145d5b1 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/api/UserApi.h @@ -0,0 +1,144 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * UserApi.h + * + * + */ + +#ifndef UserApi_H_ +#define UserApi_H_ + + +#include "ApiBase.h" + +#include +#include +#include + +#include +#include + +#include "User.h" +#include +#include + +namespace org::openapitools::server::api +{ + +class UserApi : public ApiBase { +public: + explicit UserApi(const std::shared_ptr& rtr); + ~UserApi() override = default; + void init() override; + + static const std::string base; + +private: + void setupRoutes(); + + void create_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void create_users_with_array_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void create_users_with_list_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void delete_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void get_user_by_name_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void login_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void logout_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void update_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void user_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + + /// + /// Helper function to handle unexpected Exceptions during Parameter parsing and validation. + /// May be overridden to return custom error formats. This is called inside a catch block. + /// Important: When overriding, do not call `throw ex;`, but instead use `throw;`. + /// + virtual std::pair handleParsingException(const std::exception& ex) const noexcept; + + /// + /// Helper function to handle unexpected Exceptions during processing of the request in handler functions. + /// May be overridden to return custom error formats. This is called inside a catch block. + /// Important: When overriding, do not call `throw ex;`, but instead use `throw;`. + /// + virtual std::pair handleOperationException(const std::exception& ex) const noexcept; + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Created user object + virtual void create_user(const org::openapitools::server::model::User &user, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + virtual void create_users_with_array_input(const std::vector &user, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + virtual void create_users_with_list_input(const std::vector &user, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// The name that needs to be deleted + virtual void delete_user(const std::string &username, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Get user by user name + /// + /// + /// + /// + /// The name that needs to be fetched. Use user1 for testing. + virtual void get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Logs user into the system + /// + /// + /// + /// + /// The user name for login + /// The password for login in clear text + virtual void login_user(const std::optional &username, const std::optional &password, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Logs out current logged in user session + /// + /// + /// + /// + virtual void logout_user(Pistache::Http::ResponseWriter &response) = 0; + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// name that need to be deleted + /// Updated user object + virtual void update_user(const std::string &username, const org::openapitools::server::model::User &user, Pistache::Http::ResponseWriter &response) = 0; + +}; + +} // namespace org::openapitools::server::api + +#endif /* UserApi_H_ */ + diff --git a/samples/server/petstore/cpp-pistache-everything/impl/PetApiImpl.cpp b/samples/server/petstore/cpp-pistache-everything/impl/PetApiImpl.cpp new file mode 100644 index 000000000000..9841c6d24542 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/impl/PetApiImpl.cpp @@ -0,0 +1,56 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +#include "PetApiImpl.h" + +namespace org { +namespace openapitools { +namespace server { +namespace api { + +using namespace org::openapitools::server::model; + +PetApiImpl::PetApiImpl(const std::shared_ptr& rtr) + : PetApi(rtr) +{ +} + +void PetApiImpl::add_pet(const Pet &pet, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void PetApiImpl::delete_pet(const int64_t &petId, const std::optional &apiKey, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void PetApiImpl::find_pets_by_status(const std::optional> &status, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void PetApiImpl::find_pets_by_tags(const std::optional> &tags, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void PetApiImpl::get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void PetApiImpl::update_pet(const Pet &pet, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void PetApiImpl::update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response){ + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void PetApiImpl::upload_file(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response){ + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} + +} +} +} +} + diff --git a/samples/server/petstore/cpp-pistache-everything/impl/PetApiImpl.h b/samples/server/petstore/cpp-pistache-everything/impl/PetApiImpl.h new file mode 100644 index 000000000000..07eb6101e2f8 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/impl/PetApiImpl.h @@ -0,0 +1,62 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +/* +* PetApiImpl.h +* +* +*/ + +#ifndef PET_API_IMPL_H_ +#define PET_API_IMPL_H_ + + +#include +#include +#include +#include +#include + +#include + + +#include "ApiResponse.h" +#include "Pet.h" +#include +#include + +namespace org::openapitools::server::api +{ + +using namespace org::openapitools::server::model; + +class PetApiImpl : public org::openapitools::server::api::PetApi { +public: + explicit PetApiImpl(const std::shared_ptr& rtr); + ~PetApiImpl() override = default; + + void add_pet(const Pet &pet, Pistache::Http::ResponseWriter &response); + void delete_pet(const int64_t &petId, const std::optional &apiKey, Pistache::Http::ResponseWriter &response); + void find_pets_by_status(const std::optional> &status, Pistache::Http::ResponseWriter &response); + void find_pets_by_tags(const std::optional> &tags, Pistache::Http::ResponseWriter &response); + void get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response); + void update_pet(const Pet &pet, Pistache::Http::ResponseWriter &response); + void update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response); + void upload_file(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response); + +}; + +} // namespace org::openapitools::server::api + + + +#endif diff --git a/samples/server/petstore/cpp-pistache-everything/impl/StoreApiImpl.cpp b/samples/server/petstore/cpp-pistache-everything/impl/StoreApiImpl.cpp new file mode 100644 index 000000000000..f36debfb4c39 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/impl/StoreApiImpl.cpp @@ -0,0 +1,44 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +#include "StoreApiImpl.h" + +namespace org { +namespace openapitools { +namespace server { +namespace api { + +using namespace org::openapitools::server::model; + +StoreApiImpl::StoreApiImpl(const std::shared_ptr& rtr) + : StoreApi(rtr) +{ +} + +void StoreApiImpl::delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void StoreApiImpl::get_inventory(Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void StoreApiImpl::get_order_by_id(const int64_t &orderId, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void StoreApiImpl::place_order(const Order &order, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} + +} +} +} +} + diff --git a/samples/server/petstore/cpp-pistache-everything/impl/StoreApiImpl.h b/samples/server/petstore/cpp-pistache-everything/impl/StoreApiImpl.h new file mode 100644 index 000000000000..fd654ae9e1ba --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/impl/StoreApiImpl.h @@ -0,0 +1,57 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +/* +* StoreApiImpl.h +* +* +*/ + +#ifndef STORE_API_IMPL_H_ +#define STORE_API_IMPL_H_ + + +#include +#include +#include +#include +#include + +#include + + +#include "Order.h" +#include +#include + +namespace org::openapitools::server::api +{ + +using namespace org::openapitools::server::model; + +class StoreApiImpl : public org::openapitools::server::api::StoreApi { +public: + explicit StoreApiImpl(const std::shared_ptr& rtr); + ~StoreApiImpl() override = default; + + void delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response); + void get_inventory(Pistache::Http::ResponseWriter &response); + void get_order_by_id(const int64_t &orderId, Pistache::Http::ResponseWriter &response); + void place_order(const Order &order, Pistache::Http::ResponseWriter &response); + +}; + +} // namespace org::openapitools::server::api + + + +#endif diff --git a/samples/server/petstore/cpp-pistache-everything/impl/UserApiImpl.cpp b/samples/server/petstore/cpp-pistache-everything/impl/UserApiImpl.cpp new file mode 100644 index 000000000000..97a3b8451202 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/impl/UserApiImpl.cpp @@ -0,0 +1,56 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +#include "UserApiImpl.h" + +namespace org { +namespace openapitools { +namespace server { +namespace api { + +using namespace org::openapitools::server::model; + +UserApiImpl::UserApiImpl(const std::shared_ptr& rtr) + : UserApi(rtr) +{ +} + +void UserApiImpl::create_user(const User &user, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void UserApiImpl::create_users_with_array_input(const std::vector &user, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void UserApiImpl::create_users_with_list_input(const std::vector &user, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void UserApiImpl::delete_user(const std::string &username, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void UserApiImpl::get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void UserApiImpl::login_user(const std::optional &username, const std::optional &password, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void UserApiImpl::logout_user(Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} +void UserApiImpl::update_user(const std::string &username, const User &user, Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} + +} +} +} +} + diff --git a/samples/server/petstore/cpp-pistache-everything/impl/UserApiImpl.h b/samples/server/petstore/cpp-pistache-everything/impl/UserApiImpl.h new file mode 100644 index 000000000000..c0d3ea276179 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/impl/UserApiImpl.h @@ -0,0 +1,61 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +/* +* UserApiImpl.h +* +* +*/ + +#ifndef USER_API_IMPL_H_ +#define USER_API_IMPL_H_ + + +#include +#include +#include +#include +#include + +#include + + +#include "User.h" +#include +#include + +namespace org::openapitools::server::api +{ + +using namespace org::openapitools::server::model; + +class UserApiImpl : public org::openapitools::server::api::UserApi { +public: + explicit UserApiImpl(const std::shared_ptr& rtr); + ~UserApiImpl() override = default; + + void create_user(const User &user, Pistache::Http::ResponseWriter &response); + void create_users_with_array_input(const std::vector &user, Pistache::Http::ResponseWriter &response); + void create_users_with_list_input(const std::vector &user, Pistache::Http::ResponseWriter &response); + void delete_user(const std::string &username, Pistache::Http::ResponseWriter &response); + void get_user_by_name(const std::string &username, Pistache::Http::ResponseWriter &response); + void login_user(const std::optional &username, const std::optional &password, Pistache::Http::ResponseWriter &response); + void logout_user(Pistache::Http::ResponseWriter &response); + void update_user(const std::string &username, const User &user, Pistache::Http::ResponseWriter &response); + +}; + +} // namespace org::openapitools::server::api + + + +#endif diff --git a/samples/server/petstore/cpp-pistache-everything/main-api-server.cpp b/samples/server/petstore/cpp-pistache-everything/main-api-server.cpp new file mode 100644 index 000000000000..167176c33999 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/main-api-server.cpp @@ -0,0 +1,97 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "pistache/endpoint.h" +#include "pistache/http.h" +#include "pistache/router.h" +#ifdef __linux__ +#include +#include +#include +#endif + +#include "ApiBase.h" + +#include "PetApiImpl.h" +#include "StoreApiImpl.h" +#include "UserApiImpl.h" + +#define PISTACHE_SERVER_THREADS 2 +#define PISTACHE_SERVER_MAX_REQUEST_SIZE 32768 +#define PISTACHE_SERVER_MAX_RESPONSE_SIZE 32768 + +static Pistache::Http::Endpoint *httpEndpoint; +#ifdef __linux__ +static void sigHandler [[noreturn]] (int sig){ + switch(sig){ + case SIGINT: + case SIGQUIT: + case SIGTERM: + case SIGHUP: + default: + httpEndpoint->shutdown(); + break; + } + exit(0); +} + +static void setUpUnixSignals(std::vector quitSignals) { + sigset_t blocking_mask; + sigemptyset(&blocking_mask); + for (auto sig : quitSignals) + sigaddset(&blocking_mask, sig); + + struct sigaction sa; + sa.sa_handler = sigHandler; + sa.sa_mask = blocking_mask; + sa.sa_flags = 0; + + for (auto sig : quitSignals) + sigaction(sig, &sa, nullptr); +} +#endif + +using namespace org::openapitools::server::api; + +int main() { +#ifdef __linux__ + std::vector sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP}; + setUpUnixSignals(sigs); +#endif + Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080)); + + httpEndpoint = new Pistache::Http::Endpoint((addr)); + auto router = std::make_shared(); + + auto opts = Pistache::Http::Endpoint::options() + .threads(PISTACHE_SERVER_THREADS); + opts.flags(Pistache::Tcp::Options::ReuseAddr); + opts.maxRequestSize(PISTACHE_SERVER_MAX_REQUEST_SIZE); + opts.maxResponseSize(PISTACHE_SERVER_MAX_RESPONSE_SIZE); + httpEndpoint->init(opts); + + auto apiImpls = std::vector>(); + + apiImpls.push_back(std::make_shared(router)); + apiImpls.push_back(std::make_shared(router)); + apiImpls.push_back(std::make_shared(router)); + + for (auto api : apiImpls) { + api->init(); + } + + httpEndpoint->setHandler(router->handler()); + httpEndpoint->serve(); + + httpEndpoint->shutdown(); +} diff --git a/samples/server/petstore/cpp-pistache-everything/model/ApiResponse.cpp b/samples/server/petstore/cpp-pistache-everything/model/ApiResponse.cpp new file mode 100644 index 000000000000..1513f3f34add --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/ApiResponse.cpp @@ -0,0 +1,164 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "ApiResponse.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +ApiResponse::ApiResponse() +{ + m_Code = 0; + m_CodeIsSet = false; + m_Type = ""; + m_TypeIsSet = false; + m_Message = ""; + m_MessageIsSet = false; + +} + +void ApiResponse::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool ApiResponse::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool ApiResponse::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "ApiResponse" : pathPrefix; + + + return success; +} + +bool ApiResponse::operator==(const ApiResponse& rhs) const +{ + return + + + + ((!codeIsSet() && !rhs.codeIsSet()) || (codeIsSet() && rhs.codeIsSet() && getCode() == rhs.getCode())) && + + + ((!typeIsSet() && !rhs.typeIsSet()) || (typeIsSet() && rhs.typeIsSet() && getType() == rhs.getType())) && + + + ((!messageIsSet() && !rhs.messageIsSet()) || (messageIsSet() && rhs.messageIsSet() && getMessage() == rhs.getMessage())) + + ; +} + +bool ApiResponse::operator!=(const ApiResponse& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const ApiResponse& o) +{ + j = nlohmann::json::object(); + if(o.codeIsSet()) + j["code"] = o.m_Code; + if(o.typeIsSet()) + j["type"] = o.m_Type; + if(o.messageIsSet()) + j["message"] = o.m_Message; + +} + +void from_json(const nlohmann::json& j, ApiResponse& o) +{ + if(j.find("code") != j.end()) + { + j.at("code").get_to(o.m_Code); + o.m_CodeIsSet = true; + } + if(j.find("type") != j.end()) + { + j.at("type").get_to(o.m_Type); + o.m_TypeIsSet = true; + } + if(j.find("message") != j.end()) + { + j.at("message").get_to(o.m_Message); + o.m_MessageIsSet = true; + } + +} + +int32_t ApiResponse::getCode() const +{ + return m_Code; +} +void ApiResponse::setCode(int32_t const value) +{ + m_Code = value; + m_CodeIsSet = true; +} +bool ApiResponse::codeIsSet() const +{ + return m_CodeIsSet; +} +void ApiResponse::unsetCode() +{ + m_CodeIsSet = false; +} +std::string ApiResponse::getType() const +{ + return m_Type; +} +void ApiResponse::setType(std::string const& value) +{ + m_Type = value; + m_TypeIsSet = true; +} +bool ApiResponse::typeIsSet() const +{ + return m_TypeIsSet; +} +void ApiResponse::unsetType() +{ + m_TypeIsSet = false; +} +std::string ApiResponse::getMessage() const +{ + return m_Message; +} +void ApiResponse::setMessage(std::string const& value) +{ + m_Message = value; + m_MessageIsSet = true; +} +bool ApiResponse::messageIsSet() const +{ + return m_MessageIsSet; +} +void ApiResponse::unsetMessage() +{ + m_MessageIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-everything/model/ApiResponse.h b/samples/server/petstore/cpp-pistache-everything/model/ApiResponse.h new file mode 100644 index 000000000000..1daca2184088 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/ApiResponse.h @@ -0,0 +1,97 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * ApiResponse.h + * + * Describes the result of uploading an image resource + */ + +#ifndef ApiResponse_H_ +#define ApiResponse_H_ + + +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// Describes the result of uploading an image resource +/// +class ApiResponse +{ +public: + ApiResponse(); + virtual ~ApiResponse() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const ApiResponse& rhs) const; + bool operator!=(const ApiResponse& rhs) const; + + ///////////////////////////////////////////// + /// ApiResponse members + + /// + /// + /// + int32_t getCode() const; + void setCode(int32_t const value); + bool codeIsSet() const; + void unsetCode(); + /// + /// + /// + std::string getType() const; + void setType(std::string const& value); + bool typeIsSet() const; + void unsetType(); + /// + /// + /// + std::string getMessage() const; + void setMessage(std::string const& value); + bool messageIsSet() const; + void unsetMessage(); + + friend void to_json(nlohmann::json& j, const ApiResponse& o); + friend void from_json(const nlohmann::json& j, ApiResponse& o); +protected: + int32_t m_Code; + bool m_CodeIsSet; + std::string m_Type; + bool m_TypeIsSet; + std::string m_Message; + bool m_MessageIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* ApiResponse_H_ */ diff --git a/samples/server/petstore/cpp-pistache-everything/model/Category.cpp b/samples/server/petstore/cpp-pistache-everything/model/Category.cpp new file mode 100644 index 000000000000..bd76b4cd6630 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Category.cpp @@ -0,0 +1,144 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Category.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Category::Category() +{ + m_Id = 0L; + m_IdIsSet = false; + m_Name = ""; + m_NameIsSet = false; + +} + +void Category::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Category::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Category::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Category" : pathPrefix; + + + if (nameIsSet()) + { + const std::string& value = m_Name; + const std::string currentValuePath = _pathPrefix + ".name"; + + + + } + + return success; +} + +bool Category::operator==(const Category& rhs) const +{ + return + + + + ((!idIsSet() && !rhs.idIsSet()) || (idIsSet() && rhs.idIsSet() && getId() == rhs.getId())) && + + + ((!nameIsSet() && !rhs.nameIsSet()) || (nameIsSet() && rhs.nameIsSet() && getName() == rhs.getName())) + + ; +} + +bool Category::operator!=(const Category& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Category& o) +{ + j = nlohmann::json::object(); + if(o.idIsSet()) + j["id"] = o.m_Id; + if(o.nameIsSet()) + j["name"] = o.m_Name; + +} + +void from_json(const nlohmann::json& j, Category& o) +{ + if(j.find("id") != j.end()) + { + j.at("id").get_to(o.m_Id); + o.m_IdIsSet = true; + } + if(j.find("name") != j.end()) + { + j.at("name").get_to(o.m_Name); + o.m_NameIsSet = true; + } + +} + +int64_t Category::getId() const +{ + return m_Id; +} +void Category::setId(int64_t const value) +{ + m_Id = value; + m_IdIsSet = true; +} +bool Category::idIsSet() const +{ + return m_IdIsSet; +} +void Category::unsetId() +{ + m_IdIsSet = false; +} +std::string Category::getName() const +{ + return m_Name; +} +void Category::setName(std::string const& value) +{ + m_Name = value; + m_NameIsSet = true; +} +bool Category::nameIsSet() const +{ + return m_NameIsSet; +} +void Category::unsetName() +{ + m_NameIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-everything/model/Category.h b/samples/server/petstore/cpp-pistache-everything/model/Category.h new file mode 100644 index 000000000000..1e083c8ae3ef --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Category.h @@ -0,0 +1,88 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Category.h + * + * A category for a pet + */ + +#ifndef Category_H_ +#define Category_H_ + + +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// A category for a pet +/// +class Category +{ +public: + Category(); + virtual ~Category() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Category& rhs) const; + bool operator!=(const Category& rhs) const; + + ///////////////////////////////////////////// + /// Category members + + /// + /// + /// + int64_t getId() const; + void setId(int64_t const value); + bool idIsSet() const; + void unsetId(); + /// + /// + /// + std::string getName() const; + void setName(std::string const& value); + bool nameIsSet() const; + void unsetName(); + + friend void to_json(nlohmann::json& j, const Category& o); + friend void from_json(const nlohmann::json& j, Category& o); +protected: + int64_t m_Id; + bool m_IdIsSet; + std::string m_Name; + bool m_NameIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* Category_H_ */ diff --git a/samples/server/petstore/cpp-pistache-everything/model/Helpers.cpp b/samples/server/petstore/cpp-pistache-everything/model/Helpers.cpp new file mode 100644 index 000000000000..f78e0a1b40ad --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Helpers.cpp @@ -0,0 +1,148 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +#include "Helpers.h" +#include + +namespace org::openapitools::server::helpers +{ + +const std::regex regexRfc3339_date(R"(^(\d{4})\-(\d{2})\-(\d{2})$)"); +const std::regex regexRfc3339_date_time( + R"(^(\d{4})\-(\d{2})\-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(\.\d+)?([Zz]|([\+\-])(\d{2}):(\d{2}))$)" +); + + +namespace +{ + // Determine if given year is a leap year + // See RFC 3339, Appendix C https://tools.ietf.org/html/rfc3339#appendix-C + bool isLeapYear(const uint16_t year) { + return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)); + } + + bool validateDateValues(const uint16_t year, const uint16_t month, const uint16_t day) { + return !( + (month == 0 || month > 12) + || (day == 0) + || (month == 2 && day > (28 + (isLeapYear(year) ? 1 : 0))) + || (month <= 7 && day > (30 + month % 2)) + || (month >= 8 && day > (31 - month % 2)) + ); + } + + bool validateTimeValues(const uint16_t hours, const uint16_t minutes, const uint16_t seconds) { + return (hours <= 23) && (minutes <= 59) && (seconds <= 60); + } +} + +bool validateRfc3339_date(const std::string& str) { + std::smatch match; + const bool found = std::regex_search(str, match, regexRfc3339_date); + return found && validateDateValues(static_cast(std::stoi(match[1])), + static_cast(std::stoi(match[2])), + static_cast(std::stoi(match[3]))); +} + +bool validateRfc3339_date_time(const std::string& str) { + std::smatch match; + const bool found = std::regex_search(str, match, regexRfc3339_date_time); + return found + && validateDateValues(static_cast(std::stoi(match[1])), + static_cast(std::stoi(match[2])), + static_cast(std::stoi(match[3]))) + && validateTimeValues(static_cast(std::stoi(match[4])), + static_cast(std::stoi(match[5])), + static_cast(std::stoi(match[6]))); +} + +std::string toStringValue(const std::string &value){ + return std::string(value); +} + +std::string toStringValue(const int32_t value){ + return std::to_string(value); +} + +std::string toStringValue(const int64_t value){ + return std::to_string(value); +} + +std::string toStringValue(const bool value){ + return value ? std::string("true") : std::string("false"); +} + +std::string toStringValue(const float value){ + return std::to_string(value); +} + +std::string toStringValue(const double value){ + return std::to_string(value); +} + +bool fromStringValue(const std::string &inStr, std::string &value){ + value = std::string(inStr); + return true; +} + +bool fromStringValue(const std::string &inStr, int32_t &value){ + try { + value = std::stoi( inStr ); + } + catch (const std::invalid_argument&) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, int64_t &value){ + try { + value = std::stol( inStr ); + } + catch (const std::invalid_argument&) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, bool &value){ + if (inStr == "true") { + value = true; + return true; + } + if (inStr == "false") { + value = false; + return true; + } + return false; +} + +bool fromStringValue(const std::string &inStr, float &value){ + try { + value = std::stof( inStr ); + } + catch (const std::invalid_argument&) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, double &value){ + try { + value = std::stod( inStr ); + } + catch (const std::invalid_argument&) { + return false; + } + return true; +} + +} // namespace org::openapitools::server::helpers diff --git a/samples/server/petstore/cpp-pistache-everything/model/Helpers.h b/samples/server/petstore/cpp-pistache-everything/model/Helpers.h new file mode 100644 index 000000000000..176b817de1eb --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Helpers.h @@ -0,0 +1,136 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Helpers.h + * + * This is the helper class for models and primitives + */ + +#ifndef Helpers_H_ +#define Helpers_H_ + +#include +#include +#include +#include +#include + +namespace org::openapitools::server::helpers +{ + + class ValidationException : public std::runtime_error + { + public: + explicit ValidationException(const std::string& what) + : std::runtime_error(what) + { } + ~ValidationException() override = default; + }; + + /// + /// Validate a string against the full-date definition of RFC 3339, section 5.6. + /// + bool validateRfc3339_date(const std::string& str); + + /// + /// Validate a string against the date-time definition of RFC 3339, section 5.6. + /// + bool validateRfc3339_date_time(const std::string& str); + + namespace sfinae_helpers + { + struct NoType {}; + template NoType operator==(const T1&, const T2&); + + template class EqualsOperatorAvailable + { + public: + enum + { + value = !std::is_same< decltype(std::declval() == std::declval()), NoType >::value + }; + }; + } // namespace sfinae_helpers + + + /// + /// Determine if the given vector only has unique elements. T must provide the == operator. + /// + template + bool hasOnlyUniqueItems(const std::vector& vec) + { + static_assert(sfinae_helpers::EqualsOperatorAvailable::value, + "hasOnlyUniqueItems cannot be called, passed template type does not provide == operator."); + if (vec.size() <= 1) + { + return true; + } + // Compare every element of vec to every other element of vec. + // This isn't an elegant way to do this, since it's O(n^2), + // but it's the best solution working only with the == operator. + // This could be greatly improved if our models provided a valid hash + // and/or the < operator + for (size_t i = 0; i < vec.size() - 1; i++) + { + for (size_t j = i + 1; j < vec.size(); j++) + { + if (vec[i] == vec[j]) + { + return false; + } + } + } + return true; + } + + std::string toStringValue(const std::string &value); + std::string toStringValue(const int32_t value); + std::string toStringValue(const int64_t value); + std::string toStringValue(const bool value); + std::string toStringValue(const float value); + std::string toStringValue(const double value); + + bool fromStringValue(const std::string &inStr, std::string &value); + bool fromStringValue(const std::string &inStr, int32_t &value); + bool fromStringValue(const std::string &inStr, int64_t &value); + bool fromStringValue(const std::string &inStr, bool &value); + bool fromStringValue(const std::string &inStr, float &value); + bool fromStringValue(const std::string &inStr, double &value); + template + bool fromStringValue(const std::vector &inStr, std::vector &value){ + try{ + for(auto & item : inStr){ + T itemValue; + if(fromStringValue(item, itemValue)){ + value.push_back(itemValue); + } + } + } + catch(...){ + return false; + } + return value.size() > 0; + } + template + bool fromStringValue(const std::string &inStr, std::vector &value, char separator = ','){ + std::vector inStrings; + std::istringstream f(inStr); + std::string s; + while (std::getline(f, s, separator)) { + inStrings.push_back(s); + } + return fromStringValue(inStrings, value); + } + +} // namespace org::openapitools::server::helpers + +#endif // Helpers_H_ diff --git a/samples/server/petstore/cpp-pistache-everything/model/Order.cpp b/samples/server/petstore/cpp-pistache-everything/model/Order.cpp new file mode 100644 index 000000000000..459d6ee5d69a --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Order.cpp @@ -0,0 +1,251 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Order.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Order::Order() +{ + m_Id = 0L; + m_IdIsSet = false; + m_PetId = 0L; + m_PetIdIsSet = false; + m_Quantity = 0; + m_QuantityIsSet = false; + m_ShipDate = ""; + m_ShipDateIsSet = false; + m_Status = ""; + m_StatusIsSet = false; + m_Complete = false; + m_CompleteIsSet = false; + +} + +void Order::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Order::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Order::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Order" : pathPrefix; + + + return success; +} + +bool Order::operator==(const Order& rhs) const +{ + return + + + + ((!idIsSet() && !rhs.idIsSet()) || (idIsSet() && rhs.idIsSet() && getId() == rhs.getId())) && + + + ((!petIdIsSet() && !rhs.petIdIsSet()) || (petIdIsSet() && rhs.petIdIsSet() && getPetId() == rhs.getPetId())) && + + + ((!quantityIsSet() && !rhs.quantityIsSet()) || (quantityIsSet() && rhs.quantityIsSet() && getQuantity() == rhs.getQuantity())) && + + + ((!shipDateIsSet() && !rhs.shipDateIsSet()) || (shipDateIsSet() && rhs.shipDateIsSet() && getShipDate() == rhs.getShipDate())) && + + + ((!statusIsSet() && !rhs.statusIsSet()) || (statusIsSet() && rhs.statusIsSet() && getStatus() == rhs.getStatus())) && + + + ((!completeIsSet() && !rhs.completeIsSet()) || (completeIsSet() && rhs.completeIsSet() && isComplete() == rhs.isComplete())) + + ; +} + +bool Order::operator!=(const Order& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Order& o) +{ + j = nlohmann::json::object(); + if(o.idIsSet()) + j["id"] = o.m_Id; + if(o.petIdIsSet()) + j["petId"] = o.m_PetId; + if(o.quantityIsSet()) + j["quantity"] = o.m_Quantity; + if(o.shipDateIsSet()) + j["shipDate"] = o.m_ShipDate; + if(o.statusIsSet()) + j["status"] = o.m_Status; + if(o.completeIsSet()) + j["complete"] = o.m_Complete; + +} + +void from_json(const nlohmann::json& j, Order& o) +{ + if(j.find("id") != j.end()) + { + j.at("id").get_to(o.m_Id); + o.m_IdIsSet = true; + } + if(j.find("petId") != j.end()) + { + j.at("petId").get_to(o.m_PetId); + o.m_PetIdIsSet = true; + } + if(j.find("quantity") != j.end()) + { + j.at("quantity").get_to(o.m_Quantity); + o.m_QuantityIsSet = true; + } + if(j.find("shipDate") != j.end()) + { + j.at("shipDate").get_to(o.m_ShipDate); + o.m_ShipDateIsSet = true; + } + if(j.find("status") != j.end()) + { + j.at("status").get_to(o.m_Status); + o.m_StatusIsSet = true; + } + if(j.find("complete") != j.end()) + { + j.at("complete").get_to(o.m_Complete); + o.m_CompleteIsSet = true; + } + +} + +int64_t Order::getId() const +{ + return m_Id; +} +void Order::setId(int64_t const value) +{ + m_Id = value; + m_IdIsSet = true; +} +bool Order::idIsSet() const +{ + return m_IdIsSet; +} +void Order::unsetId() +{ + m_IdIsSet = false; +} +int64_t Order::getPetId() const +{ + return m_PetId; +} +void Order::setPetId(int64_t const value) +{ + m_PetId = value; + m_PetIdIsSet = true; +} +bool Order::petIdIsSet() const +{ + return m_PetIdIsSet; +} +void Order::unsetPetId() +{ + m_PetIdIsSet = false; +} +int32_t Order::getQuantity() const +{ + return m_Quantity; +} +void Order::setQuantity(int32_t const value) +{ + m_Quantity = value; + m_QuantityIsSet = true; +} +bool Order::quantityIsSet() const +{ + return m_QuantityIsSet; +} +void Order::unsetQuantity() +{ + m_QuantityIsSet = false; +} +std::string Order::getShipDate() const +{ + return m_ShipDate; +} +void Order::setShipDate(std::string const& value) +{ + m_ShipDate = value; + m_ShipDateIsSet = true; +} +bool Order::shipDateIsSet() const +{ + return m_ShipDateIsSet; +} +void Order::unsetShipDate() +{ + m_ShipDateIsSet = false; +} +std::string Order::getStatus() const +{ + return m_Status; +} +void Order::setStatus(std::string const& value) +{ + m_Status = value; + m_StatusIsSet = true; +} +bool Order::statusIsSet() const +{ + return m_StatusIsSet; +} +void Order::unsetStatus() +{ + m_StatusIsSet = false; +} +bool Order::isComplete() const +{ + return m_Complete; +} +void Order::setComplete(bool const value) +{ + m_Complete = value; + m_CompleteIsSet = true; +} +bool Order::completeIsSet() const +{ + return m_CompleteIsSet; +} +void Order::unsetComplete() +{ + m_CompleteIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-everything/model/Order.h b/samples/server/petstore/cpp-pistache-everything/model/Order.h new file mode 100644 index 000000000000..78a6c8805bbe --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Order.h @@ -0,0 +1,124 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Order.h + * + * An order for a pets from the pet store + */ + +#ifndef Order_H_ +#define Order_H_ + + +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// An order for a pets from the pet store +/// +class Order +{ +public: + Order(); + virtual ~Order() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Order& rhs) const; + bool operator!=(const Order& rhs) const; + + ///////////////////////////////////////////// + /// Order members + + /// + /// + /// + int64_t getId() const; + void setId(int64_t const value); + bool idIsSet() const; + void unsetId(); + /// + /// + /// + int64_t getPetId() const; + void setPetId(int64_t const value); + bool petIdIsSet() const; + void unsetPetId(); + /// + /// + /// + int32_t getQuantity() const; + void setQuantity(int32_t const value); + bool quantityIsSet() const; + void unsetQuantity(); + /// + /// + /// + std::string getShipDate() const; + void setShipDate(std::string const& value); + bool shipDateIsSet() const; + void unsetShipDate(); + /// + /// Order Status + /// + std::string getStatus() const; + void setStatus(std::string const& value); + bool statusIsSet() const; + void unsetStatus(); + /// + /// + /// + bool isComplete() const; + void setComplete(bool const value); + bool completeIsSet() const; + void unsetComplete(); + + friend void to_json(nlohmann::json& j, const Order& o); + friend void from_json(const nlohmann::json& j, Order& o); +protected: + int64_t m_Id; + bool m_IdIsSet; + int64_t m_PetId; + bool m_PetIdIsSet; + int32_t m_Quantity; + bool m_QuantityIsSet; + std::string m_ShipDate; + bool m_ShipDateIsSet; + std::string m_Status; + bool m_StatusIsSet; + bool m_Complete; + bool m_CompleteIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* Order_H_ */ diff --git a/samples/server/petstore/cpp-pistache-everything/model/Pet.cpp b/samples/server/petstore/cpp-pistache-everything/model/Pet.cpp new file mode 100644 index 000000000000..5c5971cc8c1c --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Pet.cpp @@ -0,0 +1,365 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Pet.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Pet::Pet() +{ + m_Id = 0L; + m_IdIsSet = false; + m_CategoryIsSet = false; + m_Name = ""; + m_TagsIsSet = false; + m_Status = ""; + m_StatusIsSet = false; + m_VeterinarianVisitIsSet = false; + m_GoodiesIsSet = false; + m_BestFriendsIsSet = false; + +} + +void Pet::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Pet::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Pet::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Pet" : pathPrefix; + + + + /* PhotoUrls */ { + const std::vector& value = m_PhotoUrls; + const std::string currentValuePath = _pathPrefix + ".photoUrls"; + + + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const std::string& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + + + i++; + } + } + + } + + if (tagsIsSet()) + { + const std::vector& value = m_Tags; + const std::string currentValuePath = _pathPrefix + ".tags"; + + + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const org::openapitools::server::model::Tag& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + success = value.validate(msg, currentValuePath + ".tags") && success; + + i++; + } + } + + } + + if (goodiesIsSet()) + { + const std::vector& value = m_Goodies; + const std::string currentValuePath = _pathPrefix + ".goodies"; + + + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const nlohmann::json& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + + + i++; + } + } + + } + + return success; +} + +bool Pet::operator==(const Pet& rhs) const +{ + return + + + + ((!idIsSet() && !rhs.idIsSet()) || (idIsSet() && rhs.idIsSet() && getId() == rhs.getId())) && + + + ((!categoryIsSet() && !rhs.categoryIsSet()) || (categoryIsSet() && rhs.categoryIsSet() && getCategory() == rhs.getCategory())) && + + (getName() == rhs.getName()) + && + + (getPhotoUrls() == rhs.getPhotoUrls()) + && + + + ((!tagsIsSet() && !rhs.tagsIsSet()) || (tagsIsSet() && rhs.tagsIsSet() && getTags() == rhs.getTags())) && + + + ((!statusIsSet() && !rhs.statusIsSet()) || (statusIsSet() && rhs.statusIsSet() && getStatus() == rhs.getStatus())) && + + + ((!veterinarianVisitIsSet() && !rhs.veterinarianVisitIsSet()) || (veterinarianVisitIsSet() && rhs.veterinarianVisitIsSet() && getVeterinarianVisit() == rhs.getVeterinarianVisit())) && + + + ((!goodiesIsSet() && !rhs.goodiesIsSet()) || (goodiesIsSet() && rhs.goodiesIsSet() && getGoodies() == rhs.getGoodies())) && + + + ((!bestFriendsIsSet() && !rhs.bestFriendsIsSet()) || (bestFriendsIsSet() && rhs.bestFriendsIsSet() && getBestFriends() == rhs.getBestFriends())) + + ; +} + +bool Pet::operator!=(const Pet& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Pet& o) +{ + j = nlohmann::json::object(); + if(o.idIsSet()) + j["id"] = o.m_Id; + if(o.categoryIsSet()) + j["category"] = o.m_Category; + j["name"] = o.m_Name; + j["photoUrls"] = o.m_PhotoUrls; + if(o.tagsIsSet() || !o.m_Tags.empty()) + j["tags"] = o.m_Tags; + if(o.statusIsSet()) + j["status"] = o.m_Status; + if(o.veterinarianVisitIsSet()) + j["veterinarianVisit"] = o.m_VeterinarianVisit; + if(o.goodiesIsSet() || !o.m_Goodies.empty()) + j["goodies"] = o.m_Goodies; + if(o.bestFriendsIsSet()) + j["bestFriends"] = o.m_BestFriends; + +} + +void from_json(const nlohmann::json& j, Pet& o) +{ + if(j.find("id") != j.end()) + { + j.at("id").get_to(o.m_Id); + o.m_IdIsSet = true; + } + if(j.find("category") != j.end()) + { + j.at("category").get_to(o.m_Category); + o.m_CategoryIsSet = true; + } + j.at("name").get_to(o.m_Name); + j.at("photoUrls").get_to(o.m_PhotoUrls); + if(j.find("tags") != j.end()) + { + j.at("tags").get_to(o.m_Tags); + o.m_TagsIsSet = true; + } + if(j.find("status") != j.end()) + { + j.at("status").get_to(o.m_Status); + o.m_StatusIsSet = true; + } + if(j.find("veterinarianVisit") != j.end()) + { + j.at("veterinarianVisit").get_to(o.m_VeterinarianVisit); + o.m_VeterinarianVisitIsSet = true; + } + if(j.find("goodies") != j.end()) + { + j.at("goodies").get_to(o.m_Goodies); + o.m_GoodiesIsSet = true; + } + if(j.find("bestFriends") != j.end()) + { + j.at("bestFriends").get_to(o.m_BestFriends); + o.m_BestFriendsIsSet = true; + } + +} + +int64_t Pet::getId() const +{ + return m_Id; +} +void Pet::setId(int64_t const value) +{ + m_Id = value; + m_IdIsSet = true; +} +bool Pet::idIsSet() const +{ + return m_IdIsSet; +} +void Pet::unsetId() +{ + m_IdIsSet = false; +} +org::openapitools::server::model::Category Pet::getCategory() const +{ + return m_Category; +} +void Pet::setCategory(org::openapitools::server::model::Category const& value) +{ + m_Category = value; + m_CategoryIsSet = true; +} +bool Pet::categoryIsSet() const +{ + return m_CategoryIsSet; +} +void Pet::unsetCategory() +{ + m_CategoryIsSet = false; +} +std::string Pet::getName() const +{ + return m_Name; +} +void Pet::setName(std::string const& value) +{ + m_Name = value; +} +std::vector Pet::getPhotoUrls() const +{ + return m_PhotoUrls; +} +void Pet::setPhotoUrls(std::vector const& value) +{ + m_PhotoUrls = value; +} +std::vector Pet::getTags() const +{ + return m_Tags; +} +void Pet::setTags(std::vector const& value) +{ + m_Tags = value; + m_TagsIsSet = true; +} +bool Pet::tagsIsSet() const +{ + return m_TagsIsSet; +} +void Pet::unsetTags() +{ + m_TagsIsSet = false; +} +std::string Pet::getStatus() const +{ + return m_Status; +} +void Pet::setStatus(std::string const& value) +{ + m_Status = value; + m_StatusIsSet = true; +} +bool Pet::statusIsSet() const +{ + return m_StatusIsSet; +} +void Pet::unsetStatus() +{ + m_StatusIsSet = false; +} +nlohmann::json Pet::getVeterinarianVisit() const +{ + return m_VeterinarianVisit; +} +void Pet::setVeterinarianVisit(nlohmann::json const& value) +{ + m_VeterinarianVisit = value; + m_VeterinarianVisitIsSet = true; +} +bool Pet::veterinarianVisitIsSet() const +{ + return m_VeterinarianVisitIsSet; +} +void Pet::unsetVeterinarianVisit() +{ + m_VeterinarianVisitIsSet = false; +} +std::vector Pet::getGoodies() const +{ + return m_Goodies; +} +void Pet::setGoodies(std::vector const& value) +{ + m_Goodies = value; + m_GoodiesIsSet = true; +} +bool Pet::goodiesIsSet() const +{ + return m_GoodiesIsSet; +} +void Pet::unsetGoodies() +{ + m_GoodiesIsSet = false; +} +org::openapitools::server::model::Pet_bestFriends Pet::getBestFriends() const +{ + return m_BestFriends; +} +void Pet::setBestFriends(org::openapitools::server::model::Pet_bestFriends const& value) +{ + m_BestFriends = value; + m_BestFriendsIsSet = true; +} +bool Pet::bestFriendsIsSet() const +{ + return m_BestFriendsIsSet; +} +void Pet::unsetBestFriends() +{ + m_BestFriendsIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-everything/model/Pet.h b/samples/server/petstore/cpp-pistache-everything/model/Pet.h new file mode 100644 index 000000000000..289698030791 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Pet.h @@ -0,0 +1,152 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Pet.h + * + * A pet for sale in the pet store + */ + +#ifndef Pet_H_ +#define Pet_H_ + + +#include "Tag.h" +#include +#include "Pet_bestFriends.h" +#include +#include "Category.h" +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// A pet for sale in the pet store +/// +class Pet +{ +public: + Pet(); + virtual ~Pet() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Pet& rhs) const; + bool operator!=(const Pet& rhs) const; + + ///////////////////////////////////////////// + /// Pet members + + /// + /// + /// + int64_t getId() const; + void setId(int64_t const value); + bool idIsSet() const; + void unsetId(); + /// + /// + /// + org::openapitools::server::model::Category getCategory() const; + void setCategory(org::openapitools::server::model::Category const& value); + bool categoryIsSet() const; + void unsetCategory(); + /// + /// + /// + std::string getName() const; + void setName(std::string const& value); + /// + /// + /// + std::vector getPhotoUrls() const; + void setPhotoUrls(std::vector const& value); + /// + /// + /// + std::vector getTags() const; + void setTags(std::vector const& value); + bool tagsIsSet() const; + void unsetTags(); + /// + /// pet status in the store + /// + std::string getStatus() const; + void setStatus(std::string const& value); + bool statusIsSet() const; + void unsetStatus(); + /// + /// last veterinarian visit advice + /// + nlohmann::json getVeterinarianVisit() const; + void setVeterinarianVisit(nlohmann::json const& value); + bool veterinarianVisitIsSet() const; + void unsetVeterinarianVisit(); + /// + /// to help you installing your pet at home + /// + std::vector getGoodies() const; + void setGoodies(std::vector const& value); + bool goodiesIsSet() const; + void unsetGoodies(); + /// + /// + /// + org::openapitools::server::model::Pet_bestFriends getBestFriends() const; + void setBestFriends(org::openapitools::server::model::Pet_bestFriends const& value); + bool bestFriendsIsSet() const; + void unsetBestFriends(); + + friend void to_json(nlohmann::json& j, const Pet& o); + friend void from_json(const nlohmann::json& j, Pet& o); +protected: + int64_t m_Id; + bool m_IdIsSet; + org::openapitools::server::model::Category m_Category; + bool m_CategoryIsSet; + std::string m_Name; + + std::vector m_PhotoUrls; + + std::vector m_Tags; + bool m_TagsIsSet; + std::string m_Status; + bool m_StatusIsSet; + nlohmann::json m_VeterinarianVisit; + bool m_VeterinarianVisitIsSet; + std::vector m_Goodies; + bool m_GoodiesIsSet; + org::openapitools::server::model::Pet_bestFriends m_BestFriends; + bool m_BestFriendsIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* Pet_H_ */ diff --git a/samples/server/petstore/cpp-pistache-everything/model/Pet_bestFriends.cpp b/samples/server/petstore/cpp-pistache-everything/model/Pet_bestFriends.cpp new file mode 100644 index 000000000000..bc2ec6b6af68 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Pet_bestFriends.cpp @@ -0,0 +1,116 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Pet_bestFriends.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Pet_bestFriends::Pet_bestFriends() +{ + +} + +void Pet_bestFriends::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Pet_bestFriends::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Pet_bestFriends::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Pet_bestFriends" : pathPrefix; + + + + /* BestFriends */ { + const std::vector& value = m_BestFriends; + const std::string currentValuePath = _pathPrefix + ".bestFriends"; + + + if (!org::openapitools::server::helpers::hasOnlyUniqueItems(value)) + { + success = false; + msg << currentValuePath << ": may not contain the same item more than once;"; + } + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const std::string& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + + + i++; + } + } + + } + + return success; +} + +bool Pet_bestFriends::operator==(const Pet_bestFriends& rhs) const +{ + return + + + (getBestFriends() == rhs.getBestFriends()) + + + ; +} + +bool Pet_bestFriends::operator!=(const Pet_bestFriends& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Pet_bestFriends& o) +{ + j = nlohmann::json::object(); + j["bestFriends"] = o.m_BestFriends; + +} + +void from_json(const nlohmann::json& j, Pet_bestFriends& o) +{ + j.at("bestFriends").get_to(o.m_BestFriends); + +} + +std::vector Pet_bestFriends::getBestFriends() const +{ + return m_BestFriends; +} +void Pet_bestFriends::setBestFriends(std::vector const& value) +{ + m_BestFriends = value; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-everything/model/Pet_bestFriends.h b/samples/server/petstore/cpp-pistache-everything/model/Pet_bestFriends.h new file mode 100644 index 000000000000..fc6ad4b9af33 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Pet_bestFriends.h @@ -0,0 +1,78 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Pet_bestFriends.h + * + * Pet best friends! + */ + +#ifndef Pet_bestFriends_H_ +#define Pet_bestFriends_H_ + + +#include +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// Pet best friends! +/// +class Pet_bestFriends +{ +public: + Pet_bestFriends(); + virtual ~Pet_bestFriends() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Pet_bestFriends& rhs) const; + bool operator!=(const Pet_bestFriends& rhs) const; + + ///////////////////////////////////////////// + /// Pet_bestFriends members + + /// + /// + /// + std::vector getBestFriends() const; + void setBestFriends(std::vector const& value); + + friend void to_json(nlohmann::json& j, const Pet_bestFriends& o); + friend void from_json(const nlohmann::json& j, Pet_bestFriends& o); +protected: + std::vector m_BestFriends; + + +}; + +} // namespace org::openapitools::server::model + +#endif /* Pet_bestFriends_H_ */ diff --git a/samples/server/petstore/cpp-pistache-everything/model/Tag.cpp b/samples/server/petstore/cpp-pistache-everything/model/Tag.cpp new file mode 100644 index 000000000000..8310b73b29b7 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Tag.cpp @@ -0,0 +1,135 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Tag.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Tag::Tag() +{ + m_Id = 0L; + m_IdIsSet = false; + m_Name = ""; + m_NameIsSet = false; + +} + +void Tag::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Tag::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Tag::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Tag" : pathPrefix; + + + return success; +} + +bool Tag::operator==(const Tag& rhs) const +{ + return + + + + ((!idIsSet() && !rhs.idIsSet()) || (idIsSet() && rhs.idIsSet() && getId() == rhs.getId())) && + + + ((!nameIsSet() && !rhs.nameIsSet()) || (nameIsSet() && rhs.nameIsSet() && getName() == rhs.getName())) + + ; +} + +bool Tag::operator!=(const Tag& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Tag& o) +{ + j = nlohmann::json::object(); + if(o.idIsSet()) + j["id"] = o.m_Id; + if(o.nameIsSet()) + j["name"] = o.m_Name; + +} + +void from_json(const nlohmann::json& j, Tag& o) +{ + if(j.find("id") != j.end()) + { + j.at("id").get_to(o.m_Id); + o.m_IdIsSet = true; + } + if(j.find("name") != j.end()) + { + j.at("name").get_to(o.m_Name); + o.m_NameIsSet = true; + } + +} + +int64_t Tag::getId() const +{ + return m_Id; +} +void Tag::setId(int64_t const value) +{ + m_Id = value; + m_IdIsSet = true; +} +bool Tag::idIsSet() const +{ + return m_IdIsSet; +} +void Tag::unsetId() +{ + m_IdIsSet = false; +} +std::string Tag::getName() const +{ + return m_Name; +} +void Tag::setName(std::string const& value) +{ + m_Name = value; + m_NameIsSet = true; +} +bool Tag::nameIsSet() const +{ + return m_NameIsSet; +} +void Tag::unsetName() +{ + m_NameIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-everything/model/Tag.h b/samples/server/petstore/cpp-pistache-everything/model/Tag.h new file mode 100644 index 000000000000..c9947cf6d7b3 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/Tag.h @@ -0,0 +1,88 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Tag.h + * + * A tag for a pet + */ + +#ifndef Tag_H_ +#define Tag_H_ + + +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// A tag for a pet +/// +class Tag +{ +public: + Tag(); + virtual ~Tag() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Tag& rhs) const; + bool operator!=(const Tag& rhs) const; + + ///////////////////////////////////////////// + /// Tag members + + /// + /// + /// + int64_t getId() const; + void setId(int64_t const value); + bool idIsSet() const; + void unsetId(); + /// + /// + /// + std::string getName() const; + void setName(std::string const& value); + bool nameIsSet() const; + void unsetName(); + + friend void to_json(nlohmann::json& j, const Tag& o); + friend void from_json(const nlohmann::json& j, Tag& o); +protected: + int64_t m_Id; + bool m_IdIsSet; + std::string m_Name; + bool m_NameIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* Tag_H_ */ diff --git a/samples/server/petstore/cpp-pistache-everything/model/User.cpp b/samples/server/petstore/cpp-pistache-everything/model/User.cpp new file mode 100644 index 000000000000..dc80d26a721a --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/User.cpp @@ -0,0 +1,309 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "User.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +User::User() +{ + m_Id = 0L; + m_IdIsSet = false; + m_Username = ""; + m_UsernameIsSet = false; + m_FirstName = ""; + m_FirstNameIsSet = false; + m_LastName = ""; + m_LastNameIsSet = false; + m_Email = ""; + m_EmailIsSet = false; + m_Password = ""; + m_PasswordIsSet = false; + m_Phone = ""; + m_PhoneIsSet = false; + m_UserStatus = 0; + m_UserStatusIsSet = false; + +} + +void User::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool User::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool User::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "User" : pathPrefix; + + + return success; +} + +bool User::operator==(const User& rhs) const +{ + return + + + + ((!idIsSet() && !rhs.idIsSet()) || (idIsSet() && rhs.idIsSet() && getId() == rhs.getId())) && + + + ((!usernameIsSet() && !rhs.usernameIsSet()) || (usernameIsSet() && rhs.usernameIsSet() && getUsername() == rhs.getUsername())) && + + + ((!firstNameIsSet() && !rhs.firstNameIsSet()) || (firstNameIsSet() && rhs.firstNameIsSet() && getFirstName() == rhs.getFirstName())) && + + + ((!lastNameIsSet() && !rhs.lastNameIsSet()) || (lastNameIsSet() && rhs.lastNameIsSet() && getLastName() == rhs.getLastName())) && + + + ((!emailIsSet() && !rhs.emailIsSet()) || (emailIsSet() && rhs.emailIsSet() && getEmail() == rhs.getEmail())) && + + + ((!passwordIsSet() && !rhs.passwordIsSet()) || (passwordIsSet() && rhs.passwordIsSet() && getPassword() == rhs.getPassword())) && + + + ((!phoneIsSet() && !rhs.phoneIsSet()) || (phoneIsSet() && rhs.phoneIsSet() && getPhone() == rhs.getPhone())) && + + + ((!userStatusIsSet() && !rhs.userStatusIsSet()) || (userStatusIsSet() && rhs.userStatusIsSet() && getUserStatus() == rhs.getUserStatus())) + + ; +} + +bool User::operator!=(const User& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const User& o) +{ + j = nlohmann::json::object(); + if(o.idIsSet()) + j["id"] = o.m_Id; + if(o.usernameIsSet()) + j["username"] = o.m_Username; + if(o.firstNameIsSet()) + j["firstName"] = o.m_FirstName; + if(o.lastNameIsSet()) + j["lastName"] = o.m_LastName; + if(o.emailIsSet()) + j["email"] = o.m_Email; + if(o.passwordIsSet()) + j["password"] = o.m_Password; + if(o.phoneIsSet()) + j["phone"] = o.m_Phone; + if(o.userStatusIsSet()) + j["userStatus"] = o.m_UserStatus; + +} + +void from_json(const nlohmann::json& j, User& o) +{ + if(j.find("id") != j.end()) + { + j.at("id").get_to(o.m_Id); + o.m_IdIsSet = true; + } + if(j.find("username") != j.end()) + { + j.at("username").get_to(o.m_Username); + o.m_UsernameIsSet = true; + } + if(j.find("firstName") != j.end()) + { + j.at("firstName").get_to(o.m_FirstName); + o.m_FirstNameIsSet = true; + } + if(j.find("lastName") != j.end()) + { + j.at("lastName").get_to(o.m_LastName); + o.m_LastNameIsSet = true; + } + if(j.find("email") != j.end()) + { + j.at("email").get_to(o.m_Email); + o.m_EmailIsSet = true; + } + if(j.find("password") != j.end()) + { + j.at("password").get_to(o.m_Password); + o.m_PasswordIsSet = true; + } + if(j.find("phone") != j.end()) + { + j.at("phone").get_to(o.m_Phone); + o.m_PhoneIsSet = true; + } + if(j.find("userStatus") != j.end()) + { + j.at("userStatus").get_to(o.m_UserStatus); + o.m_UserStatusIsSet = true; + } + +} + +int64_t User::getId() const +{ + return m_Id; +} +void User::setId(int64_t const value) +{ + m_Id = value; + m_IdIsSet = true; +} +bool User::idIsSet() const +{ + return m_IdIsSet; +} +void User::unsetId() +{ + m_IdIsSet = false; +} +std::string User::getUsername() const +{ + return m_Username; +} +void User::setUsername(std::string const& value) +{ + m_Username = value; + m_UsernameIsSet = true; +} +bool User::usernameIsSet() const +{ + return m_UsernameIsSet; +} +void User::unsetUsername() +{ + m_UsernameIsSet = false; +} +std::string User::getFirstName() const +{ + return m_FirstName; +} +void User::setFirstName(std::string const& value) +{ + m_FirstName = value; + m_FirstNameIsSet = true; +} +bool User::firstNameIsSet() const +{ + return m_FirstNameIsSet; +} +void User::unsetFirstName() +{ + m_FirstNameIsSet = false; +} +std::string User::getLastName() const +{ + return m_LastName; +} +void User::setLastName(std::string const& value) +{ + m_LastName = value; + m_LastNameIsSet = true; +} +bool User::lastNameIsSet() const +{ + return m_LastNameIsSet; +} +void User::unsetLastName() +{ + m_LastNameIsSet = false; +} +std::string User::getEmail() const +{ + return m_Email; +} +void User::setEmail(std::string const& value) +{ + m_Email = value; + m_EmailIsSet = true; +} +bool User::emailIsSet() const +{ + return m_EmailIsSet; +} +void User::unsetEmail() +{ + m_EmailIsSet = false; +} +std::string User::getPassword() const +{ + return m_Password; +} +void User::setPassword(std::string const& value) +{ + m_Password = value; + m_PasswordIsSet = true; +} +bool User::passwordIsSet() const +{ + return m_PasswordIsSet; +} +void User::unsetPassword() +{ + m_PasswordIsSet = false; +} +std::string User::getPhone() const +{ + return m_Phone; +} +void User::setPhone(std::string const& value) +{ + m_Phone = value; + m_PhoneIsSet = true; +} +bool User::phoneIsSet() const +{ + return m_PhoneIsSet; +} +void User::unsetPhone() +{ + m_PhoneIsSet = false; +} +int32_t User::getUserStatus() const +{ + return m_UserStatus; +} +void User::setUserStatus(int32_t const value) +{ + m_UserStatus = value; + m_UserStatusIsSet = true; +} +bool User::userStatusIsSet() const +{ + return m_UserStatusIsSet; +} +void User::unsetUserStatus() +{ + m_UserStatusIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-everything/model/User.h b/samples/server/petstore/cpp-pistache-everything/model/User.h new file mode 100644 index 000000000000..fdd5ace216d7 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-everything/model/User.h @@ -0,0 +1,142 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * User.h + * + * A User who is purchasing from the pet store + */ + +#ifndef User_H_ +#define User_H_ + + +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// A User who is purchasing from the pet store +/// +class User +{ +public: + User(); + virtual ~User() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const User& rhs) const; + bool operator!=(const User& rhs) const; + + ///////////////////////////////////////////// + /// User members + + /// + /// + /// + int64_t getId() const; + void setId(int64_t const value); + bool idIsSet() const; + void unsetId(); + /// + /// + /// + std::string getUsername() const; + void setUsername(std::string const& value); + bool usernameIsSet() const; + void unsetUsername(); + /// + /// + /// + std::string getFirstName() const; + void setFirstName(std::string const& value); + bool firstNameIsSet() const; + void unsetFirstName(); + /// + /// + /// + std::string getLastName() const; + void setLastName(std::string const& value); + bool lastNameIsSet() const; + void unsetLastName(); + /// + /// + /// + std::string getEmail() const; + void setEmail(std::string const& value); + bool emailIsSet() const; + void unsetEmail(); + /// + /// + /// + std::string getPassword() const; + void setPassword(std::string const& value); + bool passwordIsSet() const; + void unsetPassword(); + /// + /// + /// + std::string getPhone() const; + void setPhone(std::string const& value); + bool phoneIsSet() const; + void unsetPhone(); + /// + /// User Status + /// + int32_t getUserStatus() const; + void setUserStatus(int32_t const value); + bool userStatusIsSet() const; + void unsetUserStatus(); + + friend void to_json(nlohmann::json& j, const User& o); + friend void from_json(const nlohmann::json& j, User& o); +protected: + int64_t m_Id; + bool m_IdIsSet; + std::string m_Username; + bool m_UsernameIsSet; + std::string m_FirstName; + bool m_FirstNameIsSet; + std::string m_LastName; + bool m_LastNameIsSet; + std::string m_Email; + bool m_EmailIsSet; + std::string m_Password; + bool m_PasswordIsSet; + std::string m_Phone; + bool m_PhoneIsSet; + int32_t m_UserStatus; + bool m_UserStatusIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* User_H_ */ diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/.gitignore b/samples/server/petstore/cpp-pistache-nested-schema-refs/.gitignore new file mode 100644 index 000000000000..6268881d9806 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/.gitignore @@ -0,0 +1,3 @@ +build/ +external/ +pistache/ \ No newline at end of file diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator-ignore b/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator/FILES b/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator/FILES new file mode 100644 index 000000000000..1abc72ab7dfa --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator/FILES @@ -0,0 +1,14 @@ +CMakeLists.txt +README.md +api/ApiBase.h +api/StoreApi.cpp +api/StoreApi.h +impl/StoreApiImpl.cpp +impl/StoreApiImpl.h +main-api-server.cpp +model/Helpers.cpp +model/Helpers.h +model/MiddleType.cpp +model/MiddleType.h +model/OuterType.cpp +model/OuterType.h diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator/VERSION b/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator/VERSION new file mode 100644 index 000000000000..ecb21862b1ee --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/CMakeLists.txt b/samples/server/petstore/cpp-pistache-nested-schema-refs/CMakeLists.txt new file mode 100644 index 000000000000..23269deb0ff2 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required (VERSION 3.2) + +project(api-server) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pg -g3" ) + +include(ExternalProject) + +set(EXTERNAL_INSTALL_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/external) + +ExternalProject_Add(PISTACHE + GIT_REPOSITORY https://github.com/pistacheio/pistache.git + BUILD_IN_SOURCE true + INSTALL_COMMAND meson setup build --prefix=${EXTERNAL_INSTALL_LOCATION} --libdir=lib && meson install -C build +) + +ExternalProject_Add(NLOHMANN + GIT_REPOSITORY https://github.com/nlohmann/json.git + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DJSON_BuildTests=OFF +) + +include_directories(${EXTERNAL_INSTALL_LOCATION}/include) +link_directories(${EXTERNAL_INSTALL_LOCATION}/lib) + +include_directories(model) +include_directories(api) +include_directories(impl) + +file(GLOB SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/api/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/impl/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/model/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) + +add_executable(${PROJECT_NAME} ${SRCS} ) +add_dependencies(${PROJECT_NAME} PISTACHE NLOHMANN) +target_link_libraries(${PROJECT_NAME} pistache pthread) diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/README.md b/samples/server/petstore/cpp-pistache-nested-schema-refs/README.md new file mode 100644 index 000000000000..626ce4cc8a80 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/README.md @@ -0,0 +1,48 @@ +# REST API Server for Test swagger file + +## Overview +This API Server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +It uses the [Pistache](https://github.com/oktal/pistache) Framework. + +## Files organization +The Pistache C++ REST server generator creates three folders: +- `api`: This folder contains the handlers for each method specified in the OpenAPI definition. Every handler extracts +the path and body parameters (if any) from the requests and tries to parse and possibly validate them. +Once this step is completed, the main API class calls the corresponding abstract method that should be implemented +by the developer (a basic implementation is provided under the `impl` folder) +- `impl`: As written above, the implementation folder contains, for each API, the corresponding implementation class, +which extends the main API class and implements the abstract methods. +Every method receives the path and body parameters as constant reference variables and a reference to the response +object, that should be filled with the right response and sent at the end of the method with the command: +response.send(returnCode, responseBody, [mimeType]) +- `model`: This folder contains the corresponding class for every object schema found in the OpenAPI specification. + +The main folder contains also a file with a main that can be used to start the server. +Of course, is you should customize this file based on your needs + +## Installation +First of all, you need to download and install the libraries listed [here](#libraries-required). + +Once the libraries are installed, in order to compile and run the server please follow the steps below: +```bash +mkdir build +cd build +cmake .. +make +``` + +Once compiled run the server: + +```bash +cd build +./api-server +``` + +## Libraries required +- [pistache](http://pistache.io/quickstart) +- [JSON for Modern C++](https://github.com/nlohmann/json/#integration): Please download the `json.hpp` file and +put it under the model/nlohmann folder + +## Namespaces +org.openapitools.server.api +org.openapitools.server.model diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/api/ApiBase.h b/samples/server/petstore/cpp-pistache-nested-schema-refs/api/ApiBase.h new file mode 100644 index 000000000000..21ce41d1fd6b --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/api/ApiBase.h @@ -0,0 +1,39 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * ApiBase.h + * + * Generalization of the Api classes + */ + +#ifndef ApiBase_H_ +#define ApiBase_H_ + +#include +#include + +namespace org::openapitools::server::api +{ + +class ApiBase { +public: + explicit ApiBase(const std::shared_ptr& rtr) : router(rtr) {}; + virtual ~ApiBase() = default; + virtual void init() = 0; + +protected: + const std::shared_ptr router; +}; + +} // namespace org::openapitools::server::api + +#endif /* ApiBase_H_ */ diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/api/StoreApi.cpp b/samples/server/petstore/cpp-pistache-nested-schema-refs/api/StoreApi.cpp new file mode 100644 index 000000000000..afeb584db410 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/api/StoreApi.cpp @@ -0,0 +1,86 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +#include "StoreApi.h" +#include "Helpers.h" + +namespace org::openapitools::server::api +{ + +using namespace org::openapitools::server::helpers; +using namespace org::openapitools::server::model; + +const std::string StoreApi::base = ""; + +StoreApi::StoreApi(const std::shared_ptr& rtr) + : ApiBase(rtr) +{ +} + +void StoreApi::init() { + setupRoutes(); +} + +void StoreApi::setupRoutes() { + using namespace Pistache::Rest; + + Routes::Get(*router, base + "/pet", Routes::bind(&StoreApi::get_nested_object_handler, this)); + + // Default handler, called when a route is not found + router->addCustomHandler(Routes::bind(&StoreApi::store_api_default_handler, this)); +} + +std::pair StoreApi::handleParsingException(const std::exception& ex) const noexcept +{ + try { + throw; + } catch (nlohmann::detail::exception &e) { + return std::make_pair(Pistache::Http::Code::Bad_Request, e.what()); + } catch (org::openapitools::server::helpers::ValidationException &e) { + return std::make_pair(Pistache::Http::Code::Bad_Request, e.what()); + } catch (std::exception &e) { + return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what()); + } +} + +std::pair StoreApi::handleOperationException(const std::exception& ex) const noexcept +{ + return std::make_pair(Pistache::Http::Code::Internal_Server_Error, ex.what()); +} + +void StoreApi::get_nested_object_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + try { + + + try { + this->get_nested_object(response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} + +void StoreApi::store_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist"); +} + +} // namespace org::openapitools::server::api + diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/api/StoreApi.h b/samples/server/petstore/cpp-pistache-nested-schema-refs/api/StoreApi.h new file mode 100644 index 000000000000..c6b96d2c77bb --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/api/StoreApi.h @@ -0,0 +1,77 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * StoreApi.h + * + * + */ + +#ifndef StoreApi_H_ +#define StoreApi_H_ + + +#include "ApiBase.h" + +#include +#include +#include + +#include +#include + +#include "OuterType.h" + +namespace org::openapitools::server::api +{ + +class StoreApi : public ApiBase { +public: + explicit StoreApi(const std::shared_ptr& rtr); + ~StoreApi() override = default; + void init() override; + + static const std::string base; + +private: + void setupRoutes(); + + void get_nested_object_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void store_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + + /// + /// Helper function to handle unexpected Exceptions during Parameter parsing and validation. + /// May be overridden to return custom error formats. This is called inside a catch block. + /// Important: When overriding, do not call `throw ex;`, but instead use `throw;`. + /// + virtual std::pair handleParsingException(const std::exception& ex) const noexcept; + + /// + /// Helper function to handle unexpected Exceptions during processing of the request in handler functions. + /// May be overridden to return custom error formats. This is called inside a catch block. + /// Important: When overriding, do not call `throw ex;`, but instead use `throw;`. + /// + virtual std::pair handleOperationException(const std::exception& ex) const noexcept; + + /// + /// + /// + /// + /// + /// + virtual void get_nested_object(Pistache::Http::ResponseWriter &response) = 0; + +}; + +} // namespace org::openapitools::server::api + +#endif /* StoreApi_H_ */ + diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/build_petstore.sh b/samples/server/petstore/cpp-pistache-nested-schema-refs/build_petstore.sh new file mode 100644 index 000000000000..f7b8d02d3d2c --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/build_petstore.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# build C++ pistache petstore +# + +mkdir -p build +cd build +cmake .. +make -j diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/impl/StoreApiImpl.cpp b/samples/server/petstore/cpp-pistache-nested-schema-refs/impl/StoreApiImpl.cpp new file mode 100644 index 000000000000..93d057d023a3 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/impl/StoreApiImpl.cpp @@ -0,0 +1,35 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +#include "StoreApiImpl.h" + +namespace org { +namespace openapitools { +namespace server { +namespace api { + +using namespace org::openapitools::server::model; + +StoreApiImpl::StoreApiImpl(const std::shared_ptr& rtr) + : StoreApi(rtr) +{ +} + +void StoreApiImpl::get_nested_object(Pistache::Http::ResponseWriter &response) { + response.send(Pistache::Http::Code::Ok, "Do some magic\n"); +} + +} +} +} +} + diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/impl/StoreApiImpl.h b/samples/server/petstore/cpp-pistache-nested-schema-refs/impl/StoreApiImpl.h new file mode 100644 index 000000000000..29e63657ee32 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/impl/StoreApiImpl.h @@ -0,0 +1,52 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + +/* +* StoreApiImpl.h +* +* +*/ + +#ifndef STORE_API_IMPL_H_ +#define STORE_API_IMPL_H_ + + +#include +#include +#include +#include +#include + +#include + + +#include "OuterType.h" + +namespace org::openapitools::server::api +{ + +using namespace org::openapitools::server::model; + +class StoreApiImpl : public org::openapitools::server::api::StoreApi { +public: + explicit StoreApiImpl(const std::shared_ptr& rtr); + ~StoreApiImpl() override = default; + + void get_nested_object(Pistache::Http::ResponseWriter &response); + +}; + +} // namespace org::openapitools::server::api + + + +#endif diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/main-api-server.cpp b/samples/server/petstore/cpp-pistache-nested-schema-refs/main-api-server.cpp new file mode 100644 index 000000000000..017c4e493f4d --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/main-api-server.cpp @@ -0,0 +1,93 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "pistache/endpoint.h" +#include "pistache/http.h" +#include "pistache/router.h" +#ifdef __linux__ +#include +#include +#include +#endif + +#include "ApiBase.h" + +#include "StoreApiImpl.h" + +#define PISTACHE_SERVER_THREADS 2 +#define PISTACHE_SERVER_MAX_REQUEST_SIZE 32768 +#define PISTACHE_SERVER_MAX_RESPONSE_SIZE 32768 + +static Pistache::Http::Endpoint *httpEndpoint; +#ifdef __linux__ +static void sigHandler [[noreturn]] (int sig){ + switch(sig){ + case SIGINT: + case SIGQUIT: + case SIGTERM: + case SIGHUP: + default: + httpEndpoint->shutdown(); + break; + } + exit(0); +} + +static void setUpUnixSignals(std::vector quitSignals) { + sigset_t blocking_mask; + sigemptyset(&blocking_mask); + for (auto sig : quitSignals) + sigaddset(&blocking_mask, sig); + + struct sigaction sa; + sa.sa_handler = sigHandler; + sa.sa_mask = blocking_mask; + sa.sa_flags = 0; + + for (auto sig : quitSignals) + sigaction(sig, &sa, nullptr); +} +#endif + +using namespace org::openapitools::server::api; + +int main() { +#ifdef __linux__ + std::vector sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP}; + setUpUnixSignals(sigs); +#endif + Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080)); + + httpEndpoint = new Pistache::Http::Endpoint((addr)); + auto router = std::make_shared(); + + auto opts = Pistache::Http::Endpoint::options() + .threads(PISTACHE_SERVER_THREADS); + opts.flags(Pistache::Tcp::Options::ReuseAddr); + opts.maxRequestSize(PISTACHE_SERVER_MAX_REQUEST_SIZE); + opts.maxResponseSize(PISTACHE_SERVER_MAX_RESPONSE_SIZE); + httpEndpoint->init(opts); + + auto apiImpls = std::vector>(); + + apiImpls.push_back(std::make_shared(router)); + + for (auto api : apiImpls) { + api->init(); + } + + httpEndpoint->setHandler(router->handler()); + httpEndpoint->serve(); + + httpEndpoint->shutdown(); +} diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/model/Helpers.cpp b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/Helpers.cpp new file mode 100644 index 000000000000..57f0f285cf51 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/Helpers.cpp @@ -0,0 +1,148 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +#include "Helpers.h" +#include + +namespace org::openapitools::server::helpers +{ + +const std::regex regexRfc3339_date(R"(^(\d{4})\-(\d{2})\-(\d{2})$)"); +const std::regex regexRfc3339_date_time( + R"(^(\d{4})\-(\d{2})\-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(\.\d+)?([Zz]|([\+\-])(\d{2}):(\d{2}))$)" +); + + +namespace +{ + // Determine if given year is a leap year + // See RFC 3339, Appendix C https://tools.ietf.org/html/rfc3339#appendix-C + bool isLeapYear(const uint16_t year) { + return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)); + } + + bool validateDateValues(const uint16_t year, const uint16_t month, const uint16_t day) { + return !( + (month == 0 || month > 12) + || (day == 0) + || (month == 2 && day > (28 + (isLeapYear(year) ? 1 : 0))) + || (month <= 7 && day > (30 + month % 2)) + || (month >= 8 && day > (31 - month % 2)) + ); + } + + bool validateTimeValues(const uint16_t hours, const uint16_t minutes, const uint16_t seconds) { + return (hours <= 23) && (minutes <= 59) && (seconds <= 60); + } +} + +bool validateRfc3339_date(const std::string& str) { + std::smatch match; + const bool found = std::regex_search(str, match, regexRfc3339_date); + return found && validateDateValues(static_cast(std::stoi(match[1])), + static_cast(std::stoi(match[2])), + static_cast(std::stoi(match[3]))); +} + +bool validateRfc3339_date_time(const std::string& str) { + std::smatch match; + const bool found = std::regex_search(str, match, regexRfc3339_date_time); + return found + && validateDateValues(static_cast(std::stoi(match[1])), + static_cast(std::stoi(match[2])), + static_cast(std::stoi(match[3]))) + && validateTimeValues(static_cast(std::stoi(match[4])), + static_cast(std::stoi(match[5])), + static_cast(std::stoi(match[6]))); +} + +std::string toStringValue(const std::string &value){ + return std::string(value); +} + +std::string toStringValue(const int32_t value){ + return std::to_string(value); +} + +std::string toStringValue(const int64_t value){ + return std::to_string(value); +} + +std::string toStringValue(const bool value){ + return value ? std::string("true") : std::string("false"); +} + +std::string toStringValue(const float value){ + return std::to_string(value); +} + +std::string toStringValue(const double value){ + return std::to_string(value); +} + +bool fromStringValue(const std::string &inStr, std::string &value){ + value = std::string(inStr); + return true; +} + +bool fromStringValue(const std::string &inStr, int32_t &value){ + try { + value = std::stoi( inStr ); + } + catch (const std::invalid_argument&) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, int64_t &value){ + try { + value = std::stol( inStr ); + } + catch (const std::invalid_argument&) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, bool &value){ + if (inStr == "true") { + value = true; + return true; + } + if (inStr == "false") { + value = false; + return true; + } + return false; +} + +bool fromStringValue(const std::string &inStr, float &value){ + try { + value = std::stof( inStr ); + } + catch (const std::invalid_argument&) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, double &value){ + try { + value = std::stod( inStr ); + } + catch (const std::invalid_argument&) { + return false; + } + return true; +} + +} // namespace org::openapitools::server::helpers diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/model/Helpers.h b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/Helpers.h new file mode 100644 index 000000000000..93a2a510414c --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/Helpers.h @@ -0,0 +1,136 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Helpers.h + * + * This is the helper class for models and primitives + */ + +#ifndef Helpers_H_ +#define Helpers_H_ + +#include +#include +#include +#include +#include + +namespace org::openapitools::server::helpers +{ + + class ValidationException : public std::runtime_error + { + public: + explicit ValidationException(const std::string& what) + : std::runtime_error(what) + { } + ~ValidationException() override = default; + }; + + /// + /// Validate a string against the full-date definition of RFC 3339, section 5.6. + /// + bool validateRfc3339_date(const std::string& str); + + /// + /// Validate a string against the date-time definition of RFC 3339, section 5.6. + /// + bool validateRfc3339_date_time(const std::string& str); + + namespace sfinae_helpers + { + struct NoType {}; + template NoType operator==(const T1&, const T2&); + + template class EqualsOperatorAvailable + { + public: + enum + { + value = !std::is_same< decltype(std::declval() == std::declval()), NoType >::value + }; + }; + } // namespace sfinae_helpers + + + /// + /// Determine if the given vector only has unique elements. T must provide the == operator. + /// + template + bool hasOnlyUniqueItems(const std::vector& vec) + { + static_assert(sfinae_helpers::EqualsOperatorAvailable::value, + "hasOnlyUniqueItems cannot be called, passed template type does not provide == operator."); + if (vec.size() <= 1) + { + return true; + } + // Compare every element of vec to every other element of vec. + // This isn't an elegant way to do this, since it's O(n^2), + // but it's the best solution working only with the == operator. + // This could be greatly improved if our models provided a valid hash + // and/or the < operator + for (size_t i = 0; i < vec.size() - 1; i++) + { + for (size_t j = i + 1; j < vec.size(); j++) + { + if (vec[i] == vec[j]) + { + return false; + } + } + } + return true; + } + + std::string toStringValue(const std::string &value); + std::string toStringValue(const int32_t value); + std::string toStringValue(const int64_t value); + std::string toStringValue(const bool value); + std::string toStringValue(const float value); + std::string toStringValue(const double value); + + bool fromStringValue(const std::string &inStr, std::string &value); + bool fromStringValue(const std::string &inStr, int32_t &value); + bool fromStringValue(const std::string &inStr, int64_t &value); + bool fromStringValue(const std::string &inStr, bool &value); + bool fromStringValue(const std::string &inStr, float &value); + bool fromStringValue(const std::string &inStr, double &value); + template + bool fromStringValue(const std::vector &inStr, std::vector &value){ + try{ + for(auto & item : inStr){ + T itemValue; + if(fromStringValue(item, itemValue)){ + value.push_back(itemValue); + } + } + } + catch(...){ + return false; + } + return value.size() > 0; + } + template + bool fromStringValue(const std::string &inStr, std::vector &value, char separator = ','){ + std::vector inStrings; + std::istringstream f(inStr); + std::string s; + while (std::getline(f, s, separator)) { + inStrings.push_back(s); + } + return fromStringValue(inStrings, value); + } + +} // namespace org::openapitools::server::helpers + +#endif // Helpers_H_ diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/model/MiddleType.cpp b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/MiddleType.cpp new file mode 100644 index 000000000000..aa4251d3bc00 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/MiddleType.cpp @@ -0,0 +1,91 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "MiddleType.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +MiddleType::MiddleType() +{ + m_Inner = ""; + +} + +void MiddleType::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool MiddleType::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool MiddleType::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "MiddleType" : pathPrefix; + + + return success; +} + +bool MiddleType::operator==(const MiddleType& rhs) const +{ + return + + + (getInner() == rhs.getInner()) + + + ; +} + +bool MiddleType::operator!=(const MiddleType& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const MiddleType& o) +{ + j = nlohmann::json::object(); + j["inner"] = o.m_Inner; + +} + +void from_json(const nlohmann::json& j, MiddleType& o) +{ + j.at("inner").get_to(o.m_Inner); + +} + +std::string MiddleType::getInner() const +{ + return m_Inner; +} +void MiddleType::setInner(std::string const& value) +{ + m_Inner = value; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/model/MiddleType.h b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/MiddleType.h new file mode 100644 index 000000000000..795d2989f871 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/MiddleType.h @@ -0,0 +1,77 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * MiddleType.h + * + * + */ + +#ifndef MiddleType_H_ +#define MiddleType_H_ + + +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// +/// +class MiddleType +{ +public: + MiddleType(); + virtual ~MiddleType() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const MiddleType& rhs) const; + bool operator!=(const MiddleType& rhs) const; + + ///////////////////////////////////////////// + /// MiddleType members + + /// + /// + /// + std::string getInner() const; + void setInner(std::string const& value); + + friend void to_json(nlohmann::json& j, const MiddleType& o); + friend void from_json(const nlohmann::json& j, MiddleType& o); +protected: + std::string m_Inner; + + +}; + +} // namespace org::openapitools::server::model + +#endif /* MiddleType_H_ */ diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/model/OuterType.cpp b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/OuterType.cpp new file mode 100644 index 000000000000..f3cc1f8076b4 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/OuterType.cpp @@ -0,0 +1,94 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "OuterType.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +OuterType::OuterType() +{ + +} + +void OuterType::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool OuterType::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool OuterType::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "OuterType" : pathPrefix; + + + if (!m_Middle.validate(msg, _pathPrefix + ".middle")) { + msg << _pathPrefix << ": Middle is invalid;"; + success = false; + } + return success; +} + +bool OuterType::operator==(const OuterType& rhs) const +{ + return + + + (getMiddle() == rhs.getMiddle()) + + + ; +} + +bool OuterType::operator!=(const OuterType& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const OuterType& o) +{ + j = nlohmann::json::object(); + j["middle"] = o.m_Middle; + +} + +void from_json(const nlohmann::json& j, OuterType& o) +{ + j.at("middle").get_to(o.m_Middle); + +} + +org::openapitools::server::model::MiddleType OuterType::getMiddle() const +{ + return m_Middle; +} +void OuterType::setMiddle(org::openapitools::server::model::MiddleType const& value) +{ + m_Middle = value; +} + + +} // namespace org::openapitools::server::model + diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/model/OuterType.h b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/OuterType.h new file mode 100644 index 000000000000..df53df3c2be7 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/model/OuterType.h @@ -0,0 +1,77 @@ +/** +* Test swagger file +* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * OuterType.h + * + * + */ + +#ifndef OuterType_H_ +#define OuterType_H_ + + +#include "MiddleType.h" +#include + +namespace org::openapitools::server::model +{ + +/// +/// +/// +class OuterType +{ +public: + OuterType(); + virtual ~OuterType() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const OuterType& rhs) const; + bool operator!=(const OuterType& rhs) const; + + ///////////////////////////////////////////// + /// OuterType members + + /// + /// + /// + org::openapitools::server::model::MiddleType getMiddle() const; + void setMiddle(org::openapitools::server::model::MiddleType const& value); + + friend void to_json(nlohmann::json& j, const OuterType& o); + friend void from_json(const nlohmann::json& j, OuterType& o); +protected: + org::openapitools::server::model::MiddleType m_Middle; + + +}; + +} // namespace org::openapitools::server::model + +#endif /* OuterType_H_ */ diff --git a/samples/server/petstore/cpp-pistache-nested-schema-refs/pom.xml b/samples/server/petstore/cpp-pistache-nested-schema-refs/pom.xml new file mode 100644 index 000000000000..66effbbbfd26 --- /dev/null +++ b/samples/server/petstore/cpp-pistache-nested-schema-refs/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + org.openapitools + CppPistacheServerTests_container_type_import + pom + 1.0-SNAPSHOT + C++ Pistache Petstore Server (Container Type Import) + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + build-pistache + integration-test + + exec + + + ./build_petstore.sh + + + + + + + diff --git a/samples/server/petstore/cpp-pistache/.gitignore b/samples/server/petstore/cpp-pistache/.gitignore new file mode 100644 index 000000000000..6268881d9806 --- /dev/null +++ b/samples/server/petstore/cpp-pistache/.gitignore @@ -0,0 +1,3 @@ +build/ +external/ +pistache/ \ No newline at end of file diff --git a/samples/server/petstore/cpp-pistache/build_petstore.sh b/samples/server/petstore/cpp-pistache/build_petstore.sh index 665f09a50541..f7b8d02d3d2c 100755 --- a/samples/server/petstore/cpp-pistache/build_petstore.sh +++ b/samples/server/petstore/cpp-pistache/build_petstore.sh @@ -2,7 +2,7 @@ # build C++ pistache petstore # -mkdir build +mkdir -p build cd build cmake .. -make +make -j diff --git a/samples/server/petstore/cpp-pistache/install_pistache.sh b/samples/server/petstore/cpp-pistache/install_pistache.sh deleted file mode 100755 index d10e3f19b37e..000000000000 --- a/samples/server/petstore/cpp-pistache/install_pistache.sh +++ /dev/null @@ -1,13 +0,0 @@ -#/bin/bash -# ref: http://pistache.io/quickstart#installing-pistache -# -echo "Installing Pistache ..." - -git clone https://github.com/oktal/pistache.git || true -cd pistache -git submodule update --init -mkdir -p build -cd build -cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. -make -sudo make install diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object.cpp b/samples/server/petstore/cpp-pistache/model/Inline_object.cpp deleted file mode 100644 index 89638a845668..000000000000 --- a/samples/server/petstore/cpp-pistache/model/Inline_object.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ - - -#include "Inline_object.h" - -namespace org { -namespace openapitools { -namespace server { -namespace model { - -Inline_object::Inline_object() -{ - m_Name = ""; - m_NameIsSet = false; - m_Status = ""; - m_StatusIsSet = false; - -} - -Inline_object::~Inline_object() -{ -} - -void Inline_object::validate() -{ - // TODO: implement validation -} - -void to_json(nlohmann::json& j, const Inline_object& o) -{ - j = nlohmann::json(); - if(o.nameIsSet()) - j["name"] = o.m_Name; - if(o.statusIsSet()) - j["status"] = o.m_Status; -} - -void from_json(const nlohmann::json& j, Inline_object& o) -{ - if(j.find("name") != j.end()) - { - j.at("name").get_to(o.m_Name); - o.m_NameIsSet = true; - } - if(j.find("status") != j.end()) - { - j.at("status").get_to(o.m_Status); - o.m_StatusIsSet = true; - } -} - -std::string Inline_object::getName() const -{ - return m_Name; -} -void Inline_object::setName(std::string const& value) -{ - m_Name = value; - m_NameIsSet = true; -} -bool Inline_object::nameIsSet() const -{ - return m_NameIsSet; -} -void Inline_object::unsetName() -{ - m_NameIsSet = false; -} -std::string Inline_object::getStatus() const -{ - return m_Status; -} -void Inline_object::setStatus(std::string const& value) -{ - m_Status = value; - m_StatusIsSet = true; -} -bool Inline_object::statusIsSet() const -{ - return m_StatusIsSet; -} -void Inline_object::unsetStatus() -{ - m_StatusIsSet = false; -} - -} -} -} -} - diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object.h b/samples/server/petstore/cpp-pistache/model/Inline_object.h deleted file mode 100644 index f407884cd885..000000000000 --- a/samples/server/petstore/cpp-pistache/model/Inline_object.h +++ /dev/null @@ -1,73 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -/* - * Inline_object.h - * - * - */ - -#ifndef Inline_object_H_ -#define Inline_object_H_ - - -#include -#include - -namespace org { -namespace openapitools { -namespace server { -namespace model { - -/// -/// -/// -class Inline_object -{ -public: - Inline_object(); - virtual ~Inline_object(); - - void validate(); - - ///////////////////////////////////////////// - /// Inline_object members - - /// - /// Updated name of the pet - /// - std::string getName() const; - void setName(std::string const& value); - bool nameIsSet() const; - void unsetName(); - /// - /// Updated status of the pet - /// - std::string getStatus() const; - void setStatus(std::string const& value); - bool statusIsSet() const; - void unsetStatus(); - - friend void to_json(nlohmann::json& j, const Inline_object& o); - friend void from_json(const nlohmann::json& j, Inline_object& o); -protected: - std::string m_Name; - bool m_NameIsSet; - std::string m_Status; - bool m_StatusIsSet; -}; - -} -} -} -} - -#endif /* Inline_object_H_ */ diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp b/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp deleted file mode 100644 index 0da3bdba2b8a..000000000000 --- a/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ - - -#include "Inline_object_1.h" - -namespace org { -namespace openapitools { -namespace server { -namespace model { - -Inline_object_1::Inline_object_1() -{ - m_AdditionalMetadata = ""; - m_AdditionalMetadataIsSet = false; - m_fileIsSet = false; - -} - -Inline_object_1::~Inline_object_1() -{ -} - -void Inline_object_1::validate() -{ - // TODO: implement validation -} - -void to_json(nlohmann::json& j, const Inline_object_1& o) -{ - j = nlohmann::json(); - if(o.additionalMetadataIsSet()) - j["additionalMetadata"] = o.m_AdditionalMetadata; - if(o.fileIsSet()) - j["file"] = o.m_file; -} - -void from_json(const nlohmann::json& j, Inline_object_1& o) -{ - if(j.find("additionalMetadata") != j.end()) - { - j.at("additionalMetadata").get_to(o.m_AdditionalMetadata); - o.m_AdditionalMetadataIsSet = true; - } - if(j.find("file") != j.end()) - { - j.at("file").get_to(o.m_file); - o.m_fileIsSet = true; - } -} - -std::string Inline_object_1::getAdditionalMetadata() const -{ - return m_AdditionalMetadata; -} -void Inline_object_1::setAdditionalMetadata(std::string const& value) -{ - m_AdditionalMetadata = value; - m_AdditionalMetadataIsSet = true; -} -bool Inline_object_1::additionalMetadataIsSet() const -{ - return m_AdditionalMetadataIsSet; -} -void Inline_object_1::unsetAdditionalMetadata() -{ - m_AdditionalMetadataIsSet = false; -} -std::string Inline_object_1::getFile() const -{ - return m_file; -} -void Inline_object_1::setFile(std::string const& value) -{ - m_file = value; - m_fileIsSet = true; -} -bool Inline_object_1::fileIsSet() const -{ - return m_fileIsSet; -} -void Inline_object_1::unsetfile() -{ - m_fileIsSet = false; -} - -} -} -} -} - diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object_1.h b/samples/server/petstore/cpp-pistache/model/Inline_object_1.h deleted file mode 100644 index a5d90b1754ec..000000000000 --- a/samples/server/petstore/cpp-pistache/model/Inline_object_1.h +++ /dev/null @@ -1,73 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -/* - * Inline_object_1.h - * - * - */ - -#ifndef Inline_object_1_H_ -#define Inline_object_1_H_ - - -#include -#include - -namespace org { -namespace openapitools { -namespace server { -namespace model { - -/// -/// -/// -class Inline_object_1 -{ -public: - Inline_object_1(); - virtual ~Inline_object_1(); - - void validate(); - - ///////////////////////////////////////////// - /// Inline_object_1 members - - /// - /// Additional data to pass to server - /// - std::string getAdditionalMetadata() const; - void setAdditionalMetadata(std::string const& value); - bool additionalMetadataIsSet() const; - void unsetAdditionalMetadata(); - /// - /// file to upload - /// - std::string getFile() const; - void setFile(std::string const& value); - bool fileIsSet() const; - void unsetfile(); - - friend void to_json(nlohmann::json& j, const Inline_object_1& o); - friend void from_json(const nlohmann::json& j, Inline_object_1& o); -protected: - std::string m_AdditionalMetadata; - bool m_AdditionalMetadataIsSet; - std::string m_file; - bool m_fileIsSet; -}; - -} -} -} -} - -#endif /* Inline_object_1_H_ */ diff --git a/samples/server/petstore/cpp-pistache/pom.xml b/samples/server/petstore/cpp-pistache/pom.xml index 3b46ac29fc3d..1ba35692115b 100644 --- a/samples/server/petstore/cpp-pistache/pom.xml +++ b/samples/server/petstore/cpp-pistache/pom.xml @@ -26,16 +26,6 @@ exec-maven-plugin 1.6.0 - - install-pistache - integration-test - - exec - - - ./install_pistache.sh - - build-pistache integration-test diff --git a/samples/server/petstore/go-api-server/api/openapi.yaml b/samples/server/petstore/go-api-server/api/openapi.yaml index 65a86866857a..f309214557fe 100644 --- a/samples/server/petstore/go-api-server/api/openapi.yaml +++ b/samples/server/petstore/go-api-server/api/openapi.yaml @@ -105,6 +105,30 @@ paths: - OPTION_3 type: string style: form + - explode: true + in: query + name: defaultInt + required: false + schema: + default: 1 + type: integer + style: form + - explode: true + in: query + name: defaultNum + required: false + schema: + default: 1.5 + type: number + style: form + - explode: true + in: query + name: defaultStr + required: false + schema: + default: default + type: string + style: form - deprecated: true description: Status values that need to be considered for filter explode: false @@ -631,10 +655,10 @@ paths: schema: type: string style: form - - description: The password for login in clear text + - description: Remember Me explode: true in: query - name: boolean_test + name: remember_me required: false schema: type: boolean @@ -702,10 +726,10 @@ paths: schema: type: string style: simple - - description: boolean query parameter + - description: Confirm the deletion explode: true in: query - name: boolean_test + name: confirmation required: false schema: type: boolean diff --git a/samples/server/petstore/go-api-server/go/api.go b/samples/server/petstore/go-api-server/go/api.go index 4d4ab7fc38bd..23d5213c5a63 100644 --- a/samples/server/petstore/go-api-server/go/api.go +++ b/samples/server/petstore/go-api-server/go/api.go @@ -71,7 +71,7 @@ type PetAPIServicer interface { AddPet(context.Context, Pet) (ImplResponse, error) DeletePet(context.Context, int64, string) (ImplResponse, error) FilterPetsByCategory(context.Context, Gender, Species, []Species) (ImplResponse, error) - FindPetsByStatus(context.Context, []string, string, string) (ImplResponse, error) + FindPetsByStatus(context.Context, []string, string, string, int32, float32, string) (ImplResponse, error) // Deprecated FindPetsByTags(context.Context, []string, time.Time, time.Time, Colour) (ImplResponse, error) GetPetById(context.Context, int64) (ImplResponse, error) diff --git a/samples/server/petstore/go-api-server/go/api_pet.go b/samples/server/petstore/go-api-server/go/api_pet.go index 693d0043ca90..8451d4cf8922 100644 --- a/samples/server/petstore/go-api-server/go/api_pet.go +++ b/samples/server/petstore/go-api-server/go/api_pet.go @@ -37,7 +37,7 @@ func WithPetAPIErrorHandler(h ErrorHandler) PetAPIOption { } // NewPetAPIController creates a default api controller -func NewPetAPIController(s PetAPIServicer, opts ...PetAPIOption) Router { +func NewPetAPIController(s PetAPIServicer, opts ...PetAPIOption) *PetAPIController { controller := &PetAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -150,7 +150,7 @@ func (c *PetAPIController) AddPet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // DeletePet - Deletes a pet @@ -172,7 +172,7 @@ func (c *PetAPIController) DeletePet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // FilterPetsByCategory - Finds Pets @@ -217,7 +217,7 @@ func (c *PetAPIController) FilterPetsByCategory(w http.ResponseWriter, r *http.R return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // FindPetsByStatus - Finds Pets by status @@ -244,14 +244,55 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque inlineEnumParam = param } else { } - result, err := c.service.FindPetsByStatus(r.Context(), statusParam, inlineEnumPathParam, inlineEnumParam) + var defaultIntParam int32 + if query.Has("defaultInt") { + param, err := parseNumericParameter[int32]( + query.Get("defaultInt"), + WithParse[int32](parseInt32), + ) + if err != nil { + c.errorHandler(w, r, &ParsingError{Param: "defaultInt", Err: err}, nil) + return + } + + defaultIntParam = param + } else { + var param int32 = 1 + defaultIntParam = param + } + var defaultNumParam float32 + if query.Has("defaultNum") { + param, err := parseNumericParameter[float32]( + query.Get("defaultNum"), + WithParse[float32](parseFloat32), + ) + if err != nil { + c.errorHandler(w, r, &ParsingError{Param: "defaultNum", Err: err}, nil) + return + } + + defaultNumParam = param + } else { + var param float32 = 1.5 + defaultNumParam = param + } + var defaultStrParam string + if query.Has("defaultStr") { + param := query.Get("defaultStr") + + defaultStrParam = param + } else { + param := "default" + defaultStrParam = param + } + result, err := c.service.FindPetsByStatus(r.Context(), statusParam, inlineEnumPathParam, inlineEnumParam, defaultIntParam, defaultNumParam, defaultStrParam) // If an error occurred, encode the error with the status code if err != nil { c.errorHandler(w, r, err, &result) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // FindPetsByTags - Finds Pets by tags @@ -304,7 +345,7 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetById - Find pet by ID @@ -325,7 +366,7 @@ func (c *PetAPIController) GetPetById(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetImageById - Returns the image for the Pet that has been previously uploaded @@ -346,7 +387,7 @@ func (c *PetAPIController) GetPetImageById(w http.ResponseWriter, r *http.Reques return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetsByTime - Get the pets by time @@ -364,7 +405,7 @@ func (c *PetAPIController) GetPetsByTime(w http.ResponseWriter, r *http.Request) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetsUsingBooleanQueryParameters - Get the pets by only using boolean query parameters @@ -427,7 +468,7 @@ func (c *PetAPIController) GetPetsUsingBooleanQueryParameters(w http.ResponseWri return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // SearchPet - Search Pets by filters @@ -497,7 +538,7 @@ func (c *PetAPIController) SearchPet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdatePet - Update an existing pet @@ -524,7 +565,7 @@ func (c *PetAPIController) UpdatePet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdatePetWithForm - Updates a pet in the store with form data @@ -555,7 +596,7 @@ func (c *PetAPIController) UpdatePetWithForm(w http.ResponseWriter, r *http.Requ return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UploadFile - uploads an image @@ -598,7 +639,7 @@ func (c *PetAPIController) UploadFile(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UploadFileArrayOfFiles - uploads images (array of files) @@ -638,5 +679,5 @@ func (c *PetAPIController) UploadFileArrayOfFiles(w http.ResponseWriter, r *http return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/petstore/go-api-server/go/api_pet_service.go b/samples/server/petstore/go-api-server/go/api_pet_service.go index f5e64cba3cbc..9786bd5f71ab 100644 --- a/samples/server/petstore/go-api-server/go/api_pet_service.go +++ b/samples/server/petstore/go-api-server/go/api_pet_service.go @@ -25,7 +25,7 @@ type PetAPIService struct { } // NewPetAPIService creates a default api service -func NewPetAPIService() PetAPIServicer { +func NewPetAPIService() *PetAPIService { return &PetAPIService{} } @@ -69,7 +69,7 @@ func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, } // FindPetsByStatus - Finds Pets by status -func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum string) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum string, defaultInt int32, defaultNum float32, defaultStr string) (ImplResponse, error) { // TODO - update FindPetsByStatus with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-api-server/go/api_store.go b/samples/server/petstore/go-api-server/go/api_store.go index 5fd5a2360286..cc1caead0e8d 100644 --- a/samples/server/petstore/go-api-server/go/api_store.go +++ b/samples/server/petstore/go-api-server/go/api_store.go @@ -35,7 +35,7 @@ func WithStoreAPIErrorHandler(h ErrorHandler) StoreAPIOption { } // NewStoreAPIController creates a default api controller -func NewStoreAPIController(s StoreAPIServicer, opts ...StoreAPIOption) Router { +func NewStoreAPIController(s StoreAPIServicer, opts ...StoreAPIOption) *StoreAPIController { controller := &StoreAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -89,7 +89,7 @@ func (c *StoreAPIController) DeleteOrder(w http.ResponseWriter, r *http.Request) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetInventory - Returns pet inventories by status @@ -101,7 +101,7 @@ func (c *StoreAPIController) GetInventory(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetOrderById - Find purchase order by ID @@ -124,7 +124,7 @@ func (c *StoreAPIController) GetOrderById(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // PlaceOrder - Place an order for a pet @@ -151,5 +151,5 @@ func (c *StoreAPIController) PlaceOrder(w http.ResponseWriter, r *http.Request) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/petstore/go-api-server/go/api_store_service.go b/samples/server/petstore/go-api-server/go/api_store_service.go index ee41bf5fdd3b..46671f7a9fd9 100644 --- a/samples/server/petstore/go-api-server/go/api_store_service.go +++ b/samples/server/petstore/go-api-server/go/api_store_service.go @@ -23,7 +23,7 @@ type StoreAPIService struct { } // NewStoreAPIService creates a default api service -func NewStoreAPIService() StoreAPIServicer { +func NewStoreAPIService() *StoreAPIService { return &StoreAPIService{} } diff --git a/samples/server/petstore/go-api-server/go/api_user.go b/samples/server/petstore/go-api-server/go/api_user.go index e7a67aab5541..f1917fa9b785 100644 --- a/samples/server/petstore/go-api-server/go/api_user.go +++ b/samples/server/petstore/go-api-server/go/api_user.go @@ -35,7 +35,7 @@ func WithUserAPIErrorHandler(h ErrorHandler) UserAPIOption { } // NewUserAPIController creates a default api controller -func NewUserAPIController(s UserAPIServicer, opts ...UserAPIOption) Router { +func NewUserAPIController(s UserAPIServicer, opts ...UserAPIOption) *UserAPIController { controller := &UserAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -118,7 +118,7 @@ func (c *UserAPIController) CreateUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // CreateUsersWithArrayInput - Creates list of users with given input array @@ -143,7 +143,7 @@ func (c *UserAPIController) CreateUsersWithArrayInput(w http.ResponseWriter, r * return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // CreateUsersWithListInput - Creates list of users with given input array @@ -168,7 +168,7 @@ func (c *UserAPIController) CreateUsersWithListInput(w http.ResponseWriter, r *h return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // DeleteUser - Delete user @@ -184,28 +184,28 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{"username"}, nil) return } - var booleanTestParam bool - if query.Has("boolean_test") { + var confirmationParam bool + if query.Has("confirmation") { param, err := parseBoolParameter( - query.Get("boolean_test"), + query.Get("confirmation"), WithParse[bool](parseBool), ) if err != nil { - c.errorHandler(w, r, &ParsingError{Param: "boolean_test", Err: err}, nil) + c.errorHandler(w, r, &ParsingError{Param: "confirmation", Err: err}, nil) return } - booleanTestParam = param + confirmationParam = param } else { } - result, err := c.service.DeleteUser(r.Context(), usernameParam, booleanTestParam) + result, err := c.service.DeleteUser(r.Context(), usernameParam, confirmationParam) // If an error occurred, encode the error with the status code if err != nil { c.errorHandler(w, r, err, &result) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetUserByName - Get user by user name @@ -223,7 +223,7 @@ func (c *UserAPIController) GetUserByName(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // LoginUser - Logs user into the system @@ -251,28 +251,28 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{Field: "password"}, nil) return } - var booleanTestParam bool - if query.Has("boolean_test") { + var rememberMeParam bool + if query.Has("remember_me") { param, err := parseBoolParameter( - query.Get("boolean_test"), + query.Get("remember_me"), WithParse[bool](parseBool), ) if err != nil { - c.errorHandler(w, r, &ParsingError{Param: "boolean_test", Err: err}, nil) + c.errorHandler(w, r, &ParsingError{Param: "remember_me", Err: err}, nil) return } - booleanTestParam = param + rememberMeParam = param } else { } - result, err := c.service.LoginUser(r.Context(), usernameParam, passwordParam, booleanTestParam) + result, err := c.service.LoginUser(r.Context(), usernameParam, passwordParam, rememberMeParam) // If an error occurred, encode the error with the status code if err != nil { c.errorHandler(w, r, err, &result) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // LogoutUser - Logs out current logged in user session @@ -284,7 +284,7 @@ func (c *UserAPIController) LogoutUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdateUser - Updated user @@ -317,5 +317,5 @@ func (c *UserAPIController) UpdateUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/petstore/go-api-server/go/api_user_service.go b/samples/server/petstore/go-api-server/go/api_user_service.go index e1353ffab53d..62332a09da48 100644 --- a/samples/server/petstore/go-api-server/go/api_user_service.go +++ b/samples/server/petstore/go-api-server/go/api_user_service.go @@ -23,7 +23,7 @@ type UserAPIService struct { } // NewUserAPIService creates a default api service -func NewUserAPIService() UserAPIServicer { +func NewUserAPIService() *UserAPIService { return &UserAPIService{} } @@ -61,7 +61,7 @@ func (s *UserAPIService) CreateUsersWithListInput(ctx context.Context, user []Us } // DeleteUser - Delete user -func (s *UserAPIService) DeleteUser(ctx context.Context, username string, booleanTest bool) (ImplResponse, error) { +func (s *UserAPIService) DeleteUser(ctx context.Context, username string, confirmation bool) (ImplResponse, error) { // TODO - update DeleteUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -92,7 +92,7 @@ func (s *UserAPIService) GetUserByName(ctx context.Context, username string) (Im } // LoginUser - Logs user into the system -func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, booleanTest bool) (ImplResponse, error) { +func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, rememberMe bool) (ImplResponse, error) { // TODO - update LoginUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-api-server/go/error.go b/samples/server/petstore/go-api-server/go/error.go index 82dc66e0ed85..ba23f89b8385 100644 --- a/samples/server/petstore/go-api-server/go/error.go +++ b/samples/server/petstore/go-api-server/go/error.go @@ -34,9 +34,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 @@ -54,15 +54,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), map[string][]string{}, w) - } else if _, ok := err.(*RequiredError); ok { - // Handle missing required errors - EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity), map[string][]string{}, w) - } else { - // Handle all other errors - EncodeJSONResponse(err.Error(), &result.Code, result.Headers, w) + _ = EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest), map[string][]string{}, 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), map[string][]string{}, w) + return + } + + // Handle all other errors + _ = EncodeJSONResponse(err.Error(), &result.Code, result.Headers, w) } diff --git a/samples/server/petstore/go-api-server/go/helpers.go b/samples/server/petstore/go-api-server/go/helpers.go index 886c0c9a17dd..027954b0c9b9 100644 --- a/samples/server/petstore/go-api-server/go/helpers.go +++ b/samples/server/petstore/go-api-server/go/helpers.go @@ -61,7 +61,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/samples/server/petstore/go-api-server/go/model_colour.go b/samples/server/petstore/go-api-server/go/model_colour.go index cb360eb0655f..a77312b65379 100644 --- a/samples/server/petstore/go-api-server/go/model_colour.go +++ b/samples/server/petstore/go-api-server/go/model_colour.go @@ -49,9 +49,9 @@ func NewColourFromValue(v string) (Colour, error) { ev := Colour(v) if ev.IsValid() { return ev, nil - } else { - return "", fmt.Errorf("invalid value '%v' for Colour: valid values are %v", v, AllowedColourEnumValues) } + + return "", fmt.Errorf("invalid value '%v' for Colour: valid values are %v", v, AllowedColourEnumValues) } diff --git a/samples/server/petstore/go-api-server/go/model_gender.go b/samples/server/petstore/go-api-server/go/model_gender.go index 20b8702c875c..410b61fd08d8 100644 --- a/samples/server/petstore/go-api-server/go/model_gender.go +++ b/samples/server/petstore/go-api-server/go/model_gender.go @@ -49,9 +49,9 @@ func NewGenderFromValue(v string) (Gender, error) { ev := Gender(v) if ev.IsValid() { return ev, nil - } else { - return "", fmt.Errorf("invalid value '%v' for Gender: valid values are %v", v, AllowedGenderEnumValues) } + + return "", fmt.Errorf("invalid value '%v' for Gender: valid values are %v", v, AllowedGenderEnumValues) } diff --git a/samples/server/petstore/go-api-server/go/model_species.go b/samples/server/petstore/go-api-server/go/model_species.go index 6384f20c9487..f236e29c48a1 100644 --- a/samples/server/petstore/go-api-server/go/model_species.go +++ b/samples/server/petstore/go-api-server/go/model_species.go @@ -58,9 +58,9 @@ func NewSpeciesFromValue(v string) (Species, error) { ev := Species(v) if ev.IsValid() { return ev, nil - } else { - return "", fmt.Errorf("invalid value '%v' for Species: valid values are %v", v, AllowedSpeciesEnumValues) } + + return "", fmt.Errorf("invalid value '%v' for Species: valid values are %v", v, AllowedSpeciesEnumValues) } diff --git a/samples/server/petstore/go-api-server/go/routers.go b/samples/server/petstore/go-api-server/go/routers.go index 1d49cd139b25..183a2d8d10f7 100644 --- a/samples/server/petstore/go-api-server/go/routers.go +++ b/samples/server/petstore/go-api-server/go/routers.go @@ -48,8 +48,7 @@ func NewRouter(routers ...Router) *mux.Router { router := mux.NewRouter().StrictSlash(true) for _, api := range routers { for name, route := range api.Routes() { - var handler http.Handler - handler = route.HandlerFunc + var handler http.Handler = route.HandlerFunc handler = Logger(handler, name) router. @@ -345,7 +344,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/samples/server/petstore/go-chi-server/api/openapi.yaml b/samples/server/petstore/go-chi-server/api/openapi.yaml index 65a86866857a..f309214557fe 100644 --- a/samples/server/petstore/go-chi-server/api/openapi.yaml +++ b/samples/server/petstore/go-chi-server/api/openapi.yaml @@ -105,6 +105,30 @@ paths: - OPTION_3 type: string style: form + - explode: true + in: query + name: defaultInt + required: false + schema: + default: 1 + type: integer + style: form + - explode: true + in: query + name: defaultNum + required: false + schema: + default: 1.5 + type: number + style: form + - explode: true + in: query + name: defaultStr + required: false + schema: + default: default + type: string + style: form - deprecated: true description: Status values that need to be considered for filter explode: false @@ -631,10 +655,10 @@ paths: schema: type: string style: form - - description: The password for login in clear text + - description: Remember Me explode: true in: query - name: boolean_test + name: remember_me required: false schema: type: boolean @@ -702,10 +726,10 @@ paths: schema: type: string style: simple - - description: boolean query parameter + - description: Confirm the deletion explode: true in: query - name: boolean_test + name: confirmation required: false schema: type: boolean diff --git a/samples/server/petstore/go-chi-server/go/api.go b/samples/server/petstore/go-chi-server/go/api.go index 4d4ab7fc38bd..23d5213c5a63 100644 --- a/samples/server/petstore/go-chi-server/go/api.go +++ b/samples/server/petstore/go-chi-server/go/api.go @@ -71,7 +71,7 @@ type PetAPIServicer interface { AddPet(context.Context, Pet) (ImplResponse, error) DeletePet(context.Context, int64, string) (ImplResponse, error) FilterPetsByCategory(context.Context, Gender, Species, []Species) (ImplResponse, error) - FindPetsByStatus(context.Context, []string, string, string) (ImplResponse, error) + FindPetsByStatus(context.Context, []string, string, string, int32, float32, string) (ImplResponse, error) // Deprecated FindPetsByTags(context.Context, []string, time.Time, time.Time, Colour) (ImplResponse, error) GetPetById(context.Context, int64) (ImplResponse, error) diff --git a/samples/server/petstore/go-chi-server/go/api_pet.go b/samples/server/petstore/go-chi-server/go/api_pet.go index 038c2f2e9bfa..a4b5448a0686 100644 --- a/samples/server/petstore/go-chi-server/go/api_pet.go +++ b/samples/server/petstore/go-chi-server/go/api_pet.go @@ -37,7 +37,7 @@ func WithPetAPIErrorHandler(h ErrorHandler) PetAPIOption { } // NewPetAPIController creates a default api controller -func NewPetAPIController(s PetAPIServicer, opts ...PetAPIOption) Router { +func NewPetAPIController(s PetAPIServicer, opts ...PetAPIOption) *PetAPIController { controller := &PetAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -150,7 +150,7 @@ func (c *PetAPIController) AddPet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // DeletePet - Deletes a pet @@ -171,7 +171,7 @@ func (c *PetAPIController) DeletePet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // FilterPetsByCategory - Finds Pets @@ -215,7 +215,7 @@ func (c *PetAPIController) FilterPetsByCategory(w http.ResponseWriter, r *http.R return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // FindPetsByStatus - Finds Pets by status @@ -241,14 +241,55 @@ func (c *PetAPIController) FindPetsByStatus(w http.ResponseWriter, r *http.Reque inlineEnumParam = param } else { } - result, err := c.service.FindPetsByStatus(r.Context(), statusParam, inlineEnumPathParam, inlineEnumParam) + var defaultIntParam int32 + if query.Has("defaultInt") { + param, err := parseNumericParameter[int32]( + query.Get("defaultInt"), + WithParse[int32](parseInt32), + ) + if err != nil { + c.errorHandler(w, r, &ParsingError{Param: "defaultInt", Err: err}, nil) + return + } + + defaultIntParam = param + } else { + var param int32 = 1 + defaultIntParam = param + } + var defaultNumParam float32 + if query.Has("defaultNum") { + param, err := parseNumericParameter[float32]( + query.Get("defaultNum"), + WithParse[float32](parseFloat32), + ) + if err != nil { + c.errorHandler(w, r, &ParsingError{Param: "defaultNum", Err: err}, nil) + return + } + + defaultNumParam = param + } else { + var param float32 = 1.5 + defaultNumParam = param + } + var defaultStrParam string + if query.Has("defaultStr") { + param := query.Get("defaultStr") + + defaultStrParam = param + } else { + param := "default" + defaultStrParam = param + } + result, err := c.service.FindPetsByStatus(r.Context(), statusParam, inlineEnumPathParam, inlineEnumParam, defaultIntParam, defaultNumParam, defaultStrParam) // If an error occurred, encode the error with the status code if err != nil { c.errorHandler(w, r, err, &result) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // FindPetsByTags - Finds Pets by tags @@ -301,7 +342,7 @@ func (c *PetAPIController) FindPetsByTags(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetById - Find pet by ID @@ -321,7 +362,7 @@ func (c *PetAPIController) GetPetById(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetImageById - Returns the image for the Pet that has been previously uploaded @@ -341,7 +382,7 @@ func (c *PetAPIController) GetPetImageById(w http.ResponseWriter, r *http.Reques return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetsByTime - Get the pets by time @@ -358,7 +399,7 @@ func (c *PetAPIController) GetPetsByTime(w http.ResponseWriter, r *http.Request) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetPetsUsingBooleanQueryParameters - Get the pets by only using boolean query parameters @@ -421,7 +462,7 @@ func (c *PetAPIController) GetPetsUsingBooleanQueryParameters(w http.ResponseWri return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // SearchPet - Search Pets by filters @@ -491,7 +532,7 @@ func (c *PetAPIController) SearchPet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdatePet - Update an existing pet @@ -518,7 +559,7 @@ func (c *PetAPIController) UpdatePet(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdatePetWithForm - Updates a pet in the store with form data @@ -548,7 +589,7 @@ func (c *PetAPIController) UpdatePetWithForm(w http.ResponseWriter, r *http.Requ return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UploadFile - uploads an image @@ -590,7 +631,7 @@ func (c *PetAPIController) UploadFile(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UploadFileArrayOfFiles - uploads images (array of files) @@ -629,5 +670,5 @@ func (c *PetAPIController) UploadFileArrayOfFiles(w http.ResponseWriter, r *http return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/petstore/go-chi-server/go/api_pet_service.go b/samples/server/petstore/go-chi-server/go/api_pet_service.go index f5e64cba3cbc..9786bd5f71ab 100644 --- a/samples/server/petstore/go-chi-server/go/api_pet_service.go +++ b/samples/server/petstore/go-chi-server/go/api_pet_service.go @@ -25,7 +25,7 @@ type PetAPIService struct { } // NewPetAPIService creates a default api service -func NewPetAPIService() PetAPIServicer { +func NewPetAPIService() *PetAPIService { return &PetAPIService{} } @@ -69,7 +69,7 @@ func (s *PetAPIService) FilterPetsByCategory(ctx context.Context, gender Gender, } // FindPetsByStatus - Finds Pets by status -func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum string) (ImplResponse, error) { +func (s *PetAPIService) FindPetsByStatus(ctx context.Context, status []string, inlineEnumPath string, inlineEnum string, defaultInt int32, defaultNum float32, defaultStr string) (ImplResponse, error) { // TODO - update FindPetsByStatus with the required logic for this service method. // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-chi-server/go/api_store.go b/samples/server/petstore/go-chi-server/go/api_store.go index 2bcc6ccd7691..e364efe39889 100644 --- a/samples/server/petstore/go-chi-server/go/api_store.go +++ b/samples/server/petstore/go-chi-server/go/api_store.go @@ -35,7 +35,7 @@ func WithStoreAPIErrorHandler(h ErrorHandler) StoreAPIOption { } // NewStoreAPIController creates a default api controller -func NewStoreAPIController(s StoreAPIServicer, opts ...StoreAPIOption) Router { +func NewStoreAPIController(s StoreAPIServicer, opts ...StoreAPIOption) *StoreAPIController { controller := &StoreAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -88,7 +88,7 @@ func (c *StoreAPIController) DeleteOrder(w http.ResponseWriter, r *http.Request) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetInventory - Returns pet inventories by status @@ -100,7 +100,7 @@ func (c *StoreAPIController) GetInventory(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetOrderById - Find purchase order by ID @@ -122,7 +122,7 @@ func (c *StoreAPIController) GetOrderById(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // PlaceOrder - Place an order for a pet @@ -149,5 +149,5 @@ func (c *StoreAPIController) PlaceOrder(w http.ResponseWriter, r *http.Request) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/petstore/go-chi-server/go/api_store_service.go b/samples/server/petstore/go-chi-server/go/api_store_service.go index ee41bf5fdd3b..46671f7a9fd9 100644 --- a/samples/server/petstore/go-chi-server/go/api_store_service.go +++ b/samples/server/petstore/go-chi-server/go/api_store_service.go @@ -23,7 +23,7 @@ type StoreAPIService struct { } // NewStoreAPIService creates a default api service -func NewStoreAPIService() StoreAPIServicer { +func NewStoreAPIService() *StoreAPIService { return &StoreAPIService{} } diff --git a/samples/server/petstore/go-chi-server/go/api_user.go b/samples/server/petstore/go-chi-server/go/api_user.go index 1a53a4981f4c..9fd0c1c5fc75 100644 --- a/samples/server/petstore/go-chi-server/go/api_user.go +++ b/samples/server/petstore/go-chi-server/go/api_user.go @@ -35,7 +35,7 @@ func WithUserAPIErrorHandler(h ErrorHandler) UserAPIOption { } // NewUserAPIController creates a default api controller -func NewUserAPIController(s UserAPIServicer, opts ...UserAPIOption) Router { +func NewUserAPIController(s UserAPIServicer, opts ...UserAPIOption) *UserAPIController { controller := &UserAPIController{ service: s, errorHandler: DefaultErrorHandler, @@ -118,7 +118,7 @@ func (c *UserAPIController) CreateUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // CreateUsersWithArrayInput - Creates list of users with given input array @@ -143,7 +143,7 @@ func (c *UserAPIController) CreateUsersWithArrayInput(w http.ResponseWriter, r * return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // CreateUsersWithListInput - Creates list of users with given input array @@ -168,7 +168,7 @@ func (c *UserAPIController) CreateUsersWithListInput(w http.ResponseWriter, r *h return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // DeleteUser - Delete user @@ -183,28 +183,28 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{"username"}, nil) return } - var booleanTestParam bool - if query.Has("boolean_test") { + var confirmationParam bool + if query.Has("confirmation") { param, err := parseBoolParameter( - query.Get("boolean_test"), + query.Get("confirmation"), WithParse[bool](parseBool), ) if err != nil { - c.errorHandler(w, r, &ParsingError{Param: "boolean_test", Err: err}, nil) + c.errorHandler(w, r, &ParsingError{Param: "confirmation", Err: err}, nil) return } - booleanTestParam = param + confirmationParam = param } else { } - result, err := c.service.DeleteUser(r.Context(), usernameParam, booleanTestParam) + result, err := c.service.DeleteUser(r.Context(), usernameParam, confirmationParam) // If an error occurred, encode the error with the status code if err != nil { c.errorHandler(w, r, err, &result) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // GetUserByName - Get user by user name @@ -221,7 +221,7 @@ func (c *UserAPIController) GetUserByName(w http.ResponseWriter, r *http.Request return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // LoginUser - Logs user into the system @@ -249,28 +249,28 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) { c.errorHandler(w, r, &RequiredError{Field: "password"}, nil) return } - var booleanTestParam bool - if query.Has("boolean_test") { + var rememberMeParam bool + if query.Has("remember_me") { param, err := parseBoolParameter( - query.Get("boolean_test"), + query.Get("remember_me"), WithParse[bool](parseBool), ) if err != nil { - c.errorHandler(w, r, &ParsingError{Param: "boolean_test", Err: err}, nil) + c.errorHandler(w, r, &ParsingError{Param: "remember_me", Err: err}, nil) return } - booleanTestParam = param + rememberMeParam = param } else { } - result, err := c.service.LoginUser(r.Context(), usernameParam, passwordParam, booleanTestParam) + result, err := c.service.LoginUser(r.Context(), usernameParam, passwordParam, rememberMeParam) // If an error occurred, encode the error with the status code if err != nil { c.errorHandler(w, r, err, &result) return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // LogoutUser - Logs out current logged in user session @@ -282,7 +282,7 @@ func (c *UserAPIController) LogoutUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } // UpdateUser - Updated user @@ -314,5 +314,5 @@ func (c *UserAPIController) UpdateUser(w http.ResponseWriter, r *http.Request) { return } // If no error, encode the body and the result code - EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) + _ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w) } diff --git a/samples/server/petstore/go-chi-server/go/api_user_service.go b/samples/server/petstore/go-chi-server/go/api_user_service.go index e1353ffab53d..62332a09da48 100644 --- a/samples/server/petstore/go-chi-server/go/api_user_service.go +++ b/samples/server/petstore/go-chi-server/go/api_user_service.go @@ -23,7 +23,7 @@ type UserAPIService struct { } // NewUserAPIService creates a default api service -func NewUserAPIService() UserAPIServicer { +func NewUserAPIService() *UserAPIService { return &UserAPIService{} } @@ -61,7 +61,7 @@ func (s *UserAPIService) CreateUsersWithListInput(ctx context.Context, user []Us } // DeleteUser - Delete user -func (s *UserAPIService) DeleteUser(ctx context.Context, username string, booleanTest bool) (ImplResponse, error) { +func (s *UserAPIService) DeleteUser(ctx context.Context, username string, confirmation bool) (ImplResponse, error) { // TODO - update DeleteUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. @@ -92,7 +92,7 @@ func (s *UserAPIService) GetUserByName(ctx context.Context, username string) (Im } // LoginUser - Logs user into the system -func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, booleanTest bool) (ImplResponse, error) { +func (s *UserAPIService) LoginUser(ctx context.Context, username string, password string, rememberMe bool) (ImplResponse, error) { // TODO - update LoginUser with the required logic for this service method. // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. diff --git a/samples/server/petstore/go-chi-server/go/error.go b/samples/server/petstore/go-chi-server/go/error.go index 82dc66e0ed85..ba23f89b8385 100644 --- a/samples/server/petstore/go-chi-server/go/error.go +++ b/samples/server/petstore/go-chi-server/go/error.go @@ -34,9 +34,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 @@ -54,15 +54,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), map[string][]string{}, w) - } else if _, ok := err.(*RequiredError); ok { - // Handle missing required errors - EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity), map[string][]string{}, w) - } else { - // Handle all other errors - EncodeJSONResponse(err.Error(), &result.Code, result.Headers, w) + _ = EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest), map[string][]string{}, 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), map[string][]string{}, w) + return + } + + // Handle all other errors + _ = EncodeJSONResponse(err.Error(), &result.Code, result.Headers, w) } diff --git a/samples/server/petstore/go-chi-server/go/helpers.go b/samples/server/petstore/go-chi-server/go/helpers.go index 886c0c9a17dd..027954b0c9b9 100644 --- a/samples/server/petstore/go-chi-server/go/helpers.go +++ b/samples/server/petstore/go-chi-server/go/helpers.go @@ -61,7 +61,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/samples/server/petstore/go-chi-server/go/model_colour.go b/samples/server/petstore/go-chi-server/go/model_colour.go index cb360eb0655f..a77312b65379 100644 --- a/samples/server/petstore/go-chi-server/go/model_colour.go +++ b/samples/server/petstore/go-chi-server/go/model_colour.go @@ -49,9 +49,9 @@ func NewColourFromValue(v string) (Colour, error) { ev := Colour(v) if ev.IsValid() { return ev, nil - } else { - return "", fmt.Errorf("invalid value '%v' for Colour: valid values are %v", v, AllowedColourEnumValues) } + + return "", fmt.Errorf("invalid value '%v' for Colour: valid values are %v", v, AllowedColourEnumValues) } diff --git a/samples/server/petstore/go-chi-server/go/model_gender.go b/samples/server/petstore/go-chi-server/go/model_gender.go index 20b8702c875c..410b61fd08d8 100644 --- a/samples/server/petstore/go-chi-server/go/model_gender.go +++ b/samples/server/petstore/go-chi-server/go/model_gender.go @@ -49,9 +49,9 @@ func NewGenderFromValue(v string) (Gender, error) { ev := Gender(v) if ev.IsValid() { return ev, nil - } else { - return "", fmt.Errorf("invalid value '%v' for Gender: valid values are %v", v, AllowedGenderEnumValues) } + + return "", fmt.Errorf("invalid value '%v' for Gender: valid values are %v", v, AllowedGenderEnumValues) } diff --git a/samples/server/petstore/go-chi-server/go/model_species.go b/samples/server/petstore/go-chi-server/go/model_species.go index 6384f20c9487..f236e29c48a1 100644 --- a/samples/server/petstore/go-chi-server/go/model_species.go +++ b/samples/server/petstore/go-chi-server/go/model_species.go @@ -58,9 +58,9 @@ func NewSpeciesFromValue(v string) (Species, error) { ev := Species(v) if ev.IsValid() { return ev, nil - } else { - return "", fmt.Errorf("invalid value '%v' for Species: valid values are %v", v, AllowedSpeciesEnumValues) } + + return "", fmt.Errorf("invalid value '%v' for Species: valid values are %v", v, AllowedSpeciesEnumValues) } diff --git a/samples/server/petstore/go-chi-server/go/routers.go b/samples/server/petstore/go-chi-server/go/routers.go index ef9200e0a24c..4d662e273c58 100644 --- a/samples/server/petstore/go-chi-server/go/routers.go +++ b/samples/server/petstore/go-chi-server/go/routers.go @@ -50,8 +50,7 @@ func NewRouter(routers ...Router) chi.Router { router.Use(middleware.Logger) for _, api := range routers { for _, route := range api.Routes() { - var handler http.Handler - handler = route.HandlerFunc + var handler http.Handler = route.HandlerFunc router.Method(route.Method, route.Pattern, handler) } } @@ -341,7 +340,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/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelList.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelList.java index 999c8b087bb8..5ae57a336eb8 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelList.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelList.java @@ -3,7 +3,6 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonTypeName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/samples/server/petstore/java-microprofile/.openapi-generator-ignore b/samples/server/petstore/java-microprofile/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/java-microprofile/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/java-microprofile/.openapi-generator/FILES b/samples/server/petstore/java-microprofile/.openapi-generator/FILES new file mode 100644 index 000000000000..64572f1a20a4 --- /dev/null +++ b/samples/server/petstore/java-microprofile/.openapi-generator/FILES @@ -0,0 +1,23 @@ +README.md +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +pom.xml +src/main/java/org/openapitools/server/RFC3339DateFormat.java +src/main/java/org/openapitools/server/api/ApiException.java +src/main/java/org/openapitools/server/api/ApiExceptionMapper.java +src/main/java/org/openapitools/server/api/PetApi.java +src/main/java/org/openapitools/server/api/StoreApi.java +src/main/java/org/openapitools/server/api/UserApi.java +src/main/java/org/openapitools/server/model/Category.java +src/main/java/org/openapitools/server/model/ModelApiResponse.java +src/main/java/org/openapitools/server/model/Order.java +src/main/java/org/openapitools/server/model/Pet.java +src/main/java/org/openapitools/server/model/Tag.java +src/main/java/org/openapitools/server/model/User.java diff --git a/samples/server/petstore/java-microprofile/.openapi-generator/VERSION b/samples/server/petstore/java-microprofile/.openapi-generator/VERSION new file mode 100644 index 000000000000..ecb21862b1ee --- /dev/null +++ b/samples/server/petstore/java-microprofile/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/java-microprofile/README.md b/samples/server/petstore/java-microprofile/README.md new file mode 100644 index 000000000000..19b499b99983 --- /dev/null +++ b/samples/server/petstore/java-microprofile/README.md @@ -0,0 +1,9 @@ +# OpenAPI Petstore - MicroProfile Rest Client & MicroProfile Server + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +## 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. diff --git a/samples/server/petstore/java-microprofile/docs/Category.md b/samples/server/petstore/java-microprofile/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/server/petstore/java-microprofile/docs/ModelApiResponse.md b/samples/server/petstore/java-microprofile/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/server/petstore/java-microprofile/docs/Order.md b/samples/server/petstore/java-microprofile/docs/Order.md new file mode 100644 index 000000000000..7bfa42e6a902 --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **Date** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/server/petstore/java-microprofile/docs/Pet.md b/samples/server/petstore/java-microprofile/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/server/petstore/java-microprofile/docs/PetApi.md b/samples/server/petstore/java-microprofile/docs/PetApi.md new file mode 100644 index 000000000000..b8e20a80fc12 --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/PetApi.md @@ -0,0 +1,605 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +## addPet + +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +## deletePet + +> void deletePet(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + void result = apiInstance.deletePet(petId, apiKey); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +[**void**](Void.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +## findPetsByTags + +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **206** | successful operation | - | +| **400** | Invalid tag value | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +## updatePet + +> Pet updatePet(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> void updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + void result = apiInstance.updatePetWithForm(petId, name, status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +[**void**](Void.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/server/petstore/java-microprofile/docs/StoreApi.md b/samples/server/petstore/java-microprofile/docs/StoreApi.md new file mode 100644 index 000000000000..1b7a147054cf --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/StoreApi.md @@ -0,0 +1,283 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +## deleteOrder + +> void deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.models.*; +import org.openapitools.server.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + void result = apiInstance.deleteOrder(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +[**void**](Void.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## getInventory + +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.models.*; +import org.openapitools.server.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## placeOrder + +> Order placeOrder(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.models.*; +import org.openapitools.server.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/server/petstore/java-microprofile/docs/Tag.md b/samples/server/petstore/java-microprofile/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/server/petstore/java-microprofile/docs/User.md b/samples/server/petstore/java-microprofile/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/server/petstore/java-microprofile/docs/UserApi.md b/samples/server/petstore/java-microprofile/docs/UserApi.md new file mode 100644 index 000000000000..01db3fb54b0f --- /dev/null +++ b/samples/server/petstore/java-microprofile/docs/UserApi.md @@ -0,0 +1,591 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +## createUser + +> void createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + void result = apiInstance.createUser(user); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +[**void**](Void.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## createUsersWithArrayInput + +> void createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + void result = apiInstance.createUsersWithArrayInput(user); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +[**void**](Void.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## createUsersWithListInput + +> void createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + void result = apiInstance.createUsersWithListInput(user); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +[**void**](Void.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## deleteUser + +> void deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + void result = apiInstance.deleteUser(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +[**void**](Void.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.models.*; +import org.openapitools.server.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## loginUser + +> String loginUser(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.models.*; +import org.openapitools.server.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> void logoutUser() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + void result = apiInstance.logoutUser(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**void**](Void.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## updateUser + +> void updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.server.ApiClient; +import org.openapitools.server.ApiException; +import org.openapitools.server.Configuration; +import org.openapitools.server.auth.*; +import org.openapitools.server.models.*; +import org.openapitools.server.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + void result = apiInstance.updateUser(username, user); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +[**void**](Void.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/server/petstore/java-microprofile/pom.xml b/samples/server/petstore/java-microprofile/pom.xml new file mode 100644 index 000000000000..a3a94a523678 --- /dev/null +++ b/samples/server/petstore/java-microprofile/pom.xml @@ -0,0 +1,175 @@ + + 4.0.0 + org.openapitools + openapi-microprofile-server + jar + openapi-microprofile-server + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + 1.0.0 + + src/main/java + + + org.jboss.jandex + jandex-maven-plugin + ${jandex.maven.plugin.version} + + + make-index + + jandex + + + + + + maven-failsafe-plugin + ${maven.failsafe.plugin.version} + + + + integration-test + verify + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${build.helper.maven.plugin.version} + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + junit + junit + ${junit.version} + test + + + + org.eclipse.microprofile.rest.client + microprofile-rest-client-api + ${microprofile.rest.client.api.version} + + + + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.ws.rs.version} + provided + + + + io.smallrye + smallrye-rest-client + ${smallrye.rest.client.version} + test + + + + io.smallrye + smallrye-config + ${smallrye.config.version} + test + + + org.apache.cxf + cxf-rt-rs-extension-providers + ${cxf.rt.rs.extension.providers.version} + + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + jakarta.activation + jakarta.activation-api + ${jakarta.activation.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.jaxrs.version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation.version} + provided + + + io.smallrye.reactive + mutiny + ${mutiny.version} + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 1.8 + ${java.version} + ${java.version} + 1.5.18 + 9.2.9.v20150224 + 4.13.2 + 1.4.14 + 3.2.7 + 2.15.2 + 2.15.2 + 1.2.2 + 1.3.5 + 1.0.2 + 1.1.6 + 2.1.6 + 2.3.3 + 2.0 + 1.2.1 + 1.3.5 + 3.2.6 + 2.2.11 + 2.2.11 + 5.2.2.Final + 1.1.0 + 2.6 + 1.9.1 + UTF-8 + 1.2.0 + + diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/RFC3339DateFormat.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/RFC3339DateFormat.java new file mode 100644 index 000000000000..49a84578dcfe --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/RFC3339DateFormat.java @@ -0,0 +1,58 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaMicroprofileServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/ApiException.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/ApiException.java new file mode 100644 index 000000000000..e2c1bc5261fc --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/ApiException.java @@ -0,0 +1,34 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.api; + +import javax.ws.rs.core.Response; + +public class ApiException extends Exception { + + private static final long serialVersionUID = 1L; + private Response response; + + public ApiException() { + super(); + } + + public ApiException(Response response) { + super("Api response has status code " + response.getStatus()); + this.response = response; + } + + public Response getResponse() { + return this.response; + } +} diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/ApiExceptionMapper.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/ApiExceptionMapper.java new file mode 100644 index 000000000000..3f6b3b1e0868 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/ApiExceptionMapper.java @@ -0,0 +1,33 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.api; + +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; + +@Provider +public class ApiExceptionMapper + implements ResponseExceptionMapper { + + @Override + public boolean handles(int status, MultivaluedMap headers) { + return status >= 400; + } + + @Override + public ApiException toThrowable(Response response) { + return new ApiException(response); + } +} diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/PetApi.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/PetApi.java new file mode 100644 index 000000000000..2ca0851ef231 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/PetApi.java @@ -0,0 +1,136 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.api; + +import java.io.File; +import org.openapitools.server.model.ModelApiResponse; +import org.openapitools.server.model.Pet; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; +import io.smallrye.mutiny.Uni; + + +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +/** + * OpenAPI Petstore + * + *

This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + */ + +@RegisterProvider(ApiExceptionMapper.class) +@Path("/pet") +public interface PetApi { + + /** + * Add a new pet to the store + * + * + * + */ + @POST + + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + Uni addPet(Pet pet) throws ApiException, ProcessingException; + + /** + * Deletes a pet + * + * + * + */ + @DELETE + @Path("/{petId}") + Uni deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + */ + @GET + @Path("/findByStatus") + @Produces({ "application/xml", "application/json" }) + Uni> findPetsByStatus(@QueryParam("status") List status) throws ApiException, ProcessingException; + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @deprecated + */ + @Deprecated + @GET + @Path("/findByTags") + @Produces({ "application/xml", "application/json" }) + Uni findPetsByTags(@QueryParam("tags") List tags) throws ApiException, ProcessingException; + + /** + * Find pet by ID + * + * Returns a single pet + * + */ + @GET + @Path("/{petId}") + @Produces({ "application/xml", "application/json" }) + Uni getPetById(@PathParam("petId") Long petId) throws ApiException, ProcessingException; + + /** + * Update an existing pet + * + * + * + */ + @PUT + + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + Uni updatePet(Pet pet) throws ApiException, ProcessingException; + + /** + * Updates a pet in the store with form data + * + * + * + */ + @POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + Uni updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status) throws ApiException, ProcessingException; + + /** + * uploads an image + * + * + * + */ + @POST + @Path("/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + Uni uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment _fileDetail) throws ApiException, ProcessingException; +} diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/StoreApi.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/StoreApi.java new file mode 100644 index 000000000000..2dea0b817a57 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/StoreApi.java @@ -0,0 +1,86 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.api; + +import org.openapitools.server.model.Order; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; +import io.smallrye.mutiny.Uni; + + +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +/** + * OpenAPI Petstore + * + *

This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + */ + +@RegisterProvider(ApiExceptionMapper.class) +@Path("/store") +public interface StoreApi { + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + */ + @DELETE + @Path("/order/{orderId}") + Uni deleteOrder(@PathParam("orderId") String orderId) throws ApiException, ProcessingException; + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + */ + @GET + @Path("/inventory") + @Produces({ "application/json" }) + Uni> getInventory() throws ApiException, ProcessingException; + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + */ + @GET + @Path("/order/{orderId}") + @Produces({ "application/xml", "application/json" }) + Uni getOrderById(@PathParam("orderId") Long orderId) throws ApiException, ProcessingException; + + /** + * Place an order for a pet + * + * + * + */ + @POST + @Path("/order") + @Consumes({ "application/json" }) + @Produces({ "application/xml", "application/json" }) + Uni placeOrder(Order order) throws ApiException, ProcessingException; +} diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/UserApi.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/UserApi.java new file mode 100644 index 000000000000..ab673f1773f5 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/api/UserApi.java @@ -0,0 +1,129 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.api; + +import java.util.Date; +import org.openapitools.server.model.User; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; +import io.smallrye.mutiny.Uni; + + +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +/** + * OpenAPI Petstore + * + *

This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + */ + +@RegisterProvider(ApiExceptionMapper.class) +@Path("/user") +public interface UserApi { + + /** + * Create user + * + * This can only be done by the logged in user. + * + */ + @POST + + @Consumes({ "application/json" }) + Uni createUser(User user) throws ApiException, ProcessingException; + + /** + * Creates list of users with given input array + * + * + * + */ + @POST + @Path("/createWithArray") + @Consumes({ "application/json" }) + Uni createUsersWithArrayInput(List user) throws ApiException, ProcessingException; + + /** + * Creates list of users with given input array + * + * + * + */ + @POST + @Path("/createWithList") + @Consumes({ "application/json" }) + Uni createUsersWithListInput(List user) throws ApiException, ProcessingException; + + /** + * Delete user + * + * This can only be done by the logged in user. + * + */ + @DELETE + @Path("/{username}") + Uni deleteUser(@PathParam("username") String username) throws ApiException, ProcessingException; + + /** + * Get user by user name + * + * + * + */ + @GET + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + Uni getUserByName(@PathParam("username") String username) throws ApiException, ProcessingException; + + /** + * Logs user into the system + * + * + * + */ + @GET + @Path("/login") + @Produces({ "application/xml", "application/json" }) + Uni loginUser(@QueryParam("username") String username, @QueryParam("password") String password) throws ApiException, ProcessingException; + + /** + * Logs out current logged in user session + * + * + * + */ + @GET + @Path("/logout") + Uni logoutUser() throws ApiException, ProcessingException; + + /** + * Updated user + * + * This can only be done by the logged in user. + * + */ + @PUT + @Path("/{username}") + @Consumes({ "application/json" }) + Uni updateUser(@PathParam("username") String username, User user) throws ApiException, ProcessingException; +} diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Category.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Category.java new file mode 100644 index 000000000000..2437bd1de6d1 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Category.java @@ -0,0 +1,115 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +/** + * A category for a pet + **/ + +public class Category { + + public static final String JSON_PROPERTY_ID = "id"; + + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + + private String name; + + /** + * Get id + * @return id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + /** + * Set id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + /** + * Set name + **/ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + public Category name(String name) { + this.name = name; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/ModelApiResponse.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/ModelApiResponse.java new file mode 100644 index 000000000000..915f8a093e58 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/ModelApiResponse.java @@ -0,0 +1,146 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@JsonTypeName("ApiResponse") +/** + * Describes the result of uploading an image resource + **/ + +public class ModelApiResponse { + + public static final String JSON_PROPERTY_CODE = "code"; + + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + + private String message; + + /** + * Get code + * @return code + **/ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCode() { + return code; + } + + /** + * Set code + **/ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get type + * @return type + **/ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + /** + * Set type + **/ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get message + * @return message + **/ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + /** + * Set message + **/ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Order.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Order.java new file mode 100644 index 000000000000..977251b712e8 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Order.java @@ -0,0 +1,271 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) +/** + * An order for a pets from the pet store + **/ + +public class Order { + + public static final String JSON_PROPERTY_ID = "id"; + + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + + private Date shipDate; + + public enum StatusEnum { + + PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered")); + + + String value; + + StatusEnum (String v) { + value = v; + } + + @JsonValue + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + /** + * Order Status + **/ + + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + + private Boolean complete = false; + + /** + * Get id + * @return id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + /** + * Set id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get petId + * @return petId + **/ + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPetId() { + return petId; + } + + /** + * Set petId + **/ + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getQuantity() { + return quantity; + } + + /** + * Set quantity + **/ + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Date getShipDate() { + return shipDate; + } + + /** + * Set shipDate + **/ + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Order Status + * @return status + **/ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + /** + * Set status + **/ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get complete + * @return complete + **/ + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getComplete() { + return complete; + } + + /** + * Set complete + **/ + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(Boolean complete) { + this.complete = complete; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Pet.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Pet.java new file mode 100644 index 000000000000..48be5c7f12f2 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Pet.java @@ -0,0 +1,293 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.server.model.Category; +import org.openapitools.server.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) +/** + * A pet for sale in the pet store + **/ + +public class Pet { + + public static final String JSON_PROPERTY_ID = "id"; + + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + + private List tags = null; + + public enum StatusEnum { + + AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold")); + + + String value; + + StatusEnum (String v) { + value = v; + } + + @JsonValue + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + /** + * pet status in the store + **/ + + private StatusEnum status; + + /** + * Get id + * @return id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + /** + * Set id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get category + * @return category + **/ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Category getCategory() { + return category; + } + + /** + * Set category + **/ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(Category category) { + this.category = category; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + /** + * Set name + **/ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(String name) { + this.name = name; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getPhotoUrls() { + return photoUrls; + } + + /** + * Set photoUrls + **/ + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + /** + * Set tags + **/ + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(List tags) { + this.tags = tags; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + **/ + @Deprecated + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + /** + * Set status + **/ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Tag.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Tag.java new file mode 100644 index 000000000000..fc166497373a --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/Tag.java @@ -0,0 +1,115 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +/** + * A tag for a pet + **/ + +public class Tag { + + public static final String JSON_PROPERTY_ID = "id"; + + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + + private String name; + + /** + * Get id + * @return id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + /** + * Set id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + /** + * Set name + **/ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/User.java b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/User.java new file mode 100644 index 000000000000..f340936ab0ca --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/main/java/org/openapitools/server/model/User.java @@ -0,0 +1,298 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) +/** + * A User who is purchasing from the pet store + **/ + +public class User { + + public static final String JSON_PROPERTY_ID = "id"; + + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + /** + * User Status + **/ + + private Integer userStatus; + + /** + * Get id + * @return id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + /** + * Set id + **/ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get username + * @return username + **/ + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUsername() { + return username; + } + + /** + * Set username + **/ + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(String username) { + this.username = username; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFirstName() { + return firstName; + } + + /** + * Set firstName + **/ + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastName() { + return lastName; + } + + /** + * Set lastName + **/ + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get email + * @return email + **/ + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { + return email; + } + + /** + * Set email + **/ + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(String email) { + this.email = email; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get password + * @return password + **/ + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { + return password; + } + + /** + * Set password + **/ + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(String password) { + this.password = password; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get phone + * @return phone + **/ + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPhone() { + return phone; + } + + /** + * Set phone + **/ + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(String phone) { + this.phone = phone; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getUserStatus() { + return userStatus; + } + + /** + * Set userStatus + **/ + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/PetApiTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/PetApiTest.java new file mode 100644 index 000000000000..bb5630f26822 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/PetApiTest.java @@ -0,0 +1,201 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.api; + +import java.io.File; +import org.openapitools.server.model.ModelApiResponse; +import org.openapitools.server.model.Pet; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +import java.net.URL; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * OpenAPI Petstore Test + * + * API tests for PetApi + */ +public class PetApiTest { + + private PetApi client; + private String baseUrl = "http://localhost:9080"; + + @Before + public void setup() throws MalformedURLException { + client = RestClientBuilder.newBuilder() + .baseUrl(new URL(baseUrl)) + .register(ApiException.class) + .build(PetApi.class); + } + + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() { + // TODO: test validations + Pet pet = null; + //Uni response = api.addPet(pet); + //assertNotNull(response); + + + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() { + // TODO: test validations + Long petId = null; + String apiKey = null; + //api.deletePet(petId, apiKey); + //assertNotNull(response); + + + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() { + // TODO: test validations + List status = null; + //Uni> response = api.findPetsByStatus(status); + //assertNotNull(response); + + + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() { + // TODO: test validations + List tags = null; + //Uni> response = api.findPetsByTags(tags); + //assertNotNull(response); + + + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() { + // TODO: test validations + Long petId = null; + //Uni response = api.getPetById(petId); + //assertNotNull(response); + + + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() { + // TODO: test validations + Pet pet = null; + //Uni response = api.updatePet(pet); + //assertNotNull(response); + + + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() { + // TODO: test validations + Long petId = null; + String name = null; + String status = null; + //api.updatePetWithForm(petId, name, status); + //assertNotNull(response); + + + } + + /** + * uploads an image + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() { + // TODO: test validations + Long petId = null; + String additionalMetadata = null; + org.apache.cxf.jaxrs.ext.multipart.Attachment _file = null; + //Uni response = api.uploadFile(petId, additionalMetadata, _file); + //assertNotNull(response); + + + } + +} diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/StoreApiTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/StoreApiTest.java new file mode 100644 index 000000000000..235789386a89 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/StoreApiTest.java @@ -0,0 +1,121 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.api; + +import org.openapitools.server.model.Order; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +import java.net.URL; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * OpenAPI Petstore Test + * + * API tests for StoreApi + */ +public class StoreApiTest { + + private StoreApi client; + private String baseUrl = "http://localhost:9080"; + + @Before + public void setup() throws MalformedURLException { + client = RestClientBuilder.newBuilder() + .baseUrl(new URL(baseUrl)) + .register(ApiException.class) + .build(StoreApi.class); + } + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() { + // TODO: test validations + String orderId = null; + //api.deleteOrder(orderId); + //assertNotNull(response); + + + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() { + // TODO: test validations + //Uni> response = api.getInventory(); + //assertNotNull(response); + + + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() { + // TODO: test validations + Long orderId = null; + //Uni response = api.getOrderById(orderId); + //assertNotNull(response); + + + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() { + // TODO: test validations + Order order = null; + //Uni response = api.placeOrder(order); + //assertNotNull(response); + + + } + +} diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/UserApiTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/UserApiTest.java new file mode 100644 index 000000000000..7fcdffee4d3f --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/api/UserApiTest.java @@ -0,0 +1,196 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.api; + +import java.util.Date; +import org.openapitools.server.model.User; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +import java.net.URL; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * OpenAPI Petstore Test + * + * API tests for UserApi + */ +public class UserApiTest { + + private UserApi client; + private String baseUrl = "http://localhost:9080"; + + @Before + public void setup() throws MalformedURLException { + client = RestClientBuilder.newBuilder() + .baseUrl(new URL(baseUrl)) + .register(ApiException.class) + .build(UserApi.class); + } + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() { + // TODO: test validations + User user = null; + //api.createUser(user); + //assertNotNull(response); + + + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() { + // TODO: test validations + List user = null; + //api.createUsersWithArrayInput(user); + //assertNotNull(response); + + + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() { + // TODO: test validations + List user = null; + //api.createUsersWithListInput(user); + //assertNotNull(response); + + + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() { + // TODO: test validations + String username = null; + //api.deleteUser(username); + //assertNotNull(response); + + + } + + /** + * Get user by user name + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() { + // TODO: test validations + String username = null; + //Uni response = api.getUserByName(username); + //assertNotNull(response); + + + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() { + // TODO: test validations + String username = null; + String password = null; + //Uni response = api.loginUser(username, password); + //assertNotNull(response); + + + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() { + // TODO: test validations + //api.logoutUser(); + //assertNotNull(response); + + + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() { + // TODO: test validations + String username = null; + User user = null; + //api.updateUser(username, user); + //assertNotNull(response); + + + } + +} diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/CategoryTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/CategoryTest.java new file mode 100644 index 000000000000..e33d5467b646 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/CategoryTest.java @@ -0,0 +1,55 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/ModelApiResponseTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..645e75d17cf1 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/OrderTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/OrderTest.java new file mode 100644 index 000000000000..7cb08aa88b88 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/OrderTest.java @@ -0,0 +1,88 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Date; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/PetTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/PetTest.java new file mode 100644 index 000000000000..b96abf259b75 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/PetTest.java @@ -0,0 +1,91 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.server.model.Category; +import org.openapitools.server.model.Tag; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/TagTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/TagTest.java new file mode 100644 index 000000000000..d8dc0da8adf2 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/TagTest.java @@ -0,0 +1,55 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/UserTest.java b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/UserTest.java new file mode 100644 index 000000000000..d541f5f88803 --- /dev/null +++ b/samples/server/petstore/java-microprofile/src/test/java/org/openapitools/server/model/UserTest.java @@ -0,0 +1,103 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/server/petstore/jaxrs-spec-interface-response/pom.xml b/samples/server/petstore/jaxrs-spec-interface-response/pom.xml index becf131d1dec..67ece8e73f0b 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/pom.xml +++ b/samples/server/petstore/jaxrs-spec-interface-response/pom.xml @@ -88,6 +88,11 @@ ${beanvalidation-version} provided + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + 1.8 @@ -100,5 +105,6 @@ 1.3.2 2.0.2 2.1.6 + 0.2.6 diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index e201adcaa78a..32f5151d7854 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -62,9 +62,9 @@ public AdditionalPropertiesClass putMapStringItem(String key, String mapStringIt return this; } - public AdditionalPropertiesClass removeMapStringItem(String mapStringItem) { - if (mapStringItem != null && this.mapString != null) { - this.mapString.remove(mapStringItem); + public AdditionalPropertiesClass removeMapStringItem(String key) { + if (this.mapString != null) { + this.mapString.remove(key); } return this; @@ -97,9 +97,9 @@ public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumb return this; } - public AdditionalPropertiesClass removeMapNumberItem(BigDecimal mapNumberItem) { - if (mapNumberItem != null && this.mapNumber != null) { - this.mapNumber.remove(mapNumberItem); + public AdditionalPropertiesClass removeMapNumberItem(String key) { + if (this.mapNumber != null) { + this.mapNumber.remove(key); } return this; @@ -132,9 +132,9 @@ public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntege return this; } - public AdditionalPropertiesClass removeMapIntegerItem(Integer mapIntegerItem) { - if (mapIntegerItem != null && this.mapInteger != null) { - this.mapInteger.remove(mapIntegerItem); + public AdditionalPropertiesClass removeMapIntegerItem(String key) { + if (this.mapInteger != null) { + this.mapInteger.remove(key); } return this; @@ -167,9 +167,9 @@ public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBoolea return this; } - public AdditionalPropertiesClass removeMapBooleanItem(Boolean mapBooleanItem) { - if (mapBooleanItem != null && this.mapBoolean != null) { - this.mapBoolean.remove(mapBooleanItem); + public AdditionalPropertiesClass removeMapBooleanItem(String key) { + if (this.mapBoolean != null) { + this.mapBoolean.remove(key); } return this; @@ -202,9 +202,9 @@ public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { - if (mapArrayIntegerItem != null && this.mapArrayInteger != null) { - this.mapArrayInteger.remove(mapArrayIntegerItem); + public AdditionalPropertiesClass removeMapArrayIntegerItem(String key) { + if (this.mapArrayInteger != null) { + this.mapArrayInteger.remove(key); } return this; @@ -237,9 +237,9 @@ public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List return this; } - public AdditionalPropertiesClass removeMapArrayAnytypeItem(List mapArrayAnytypeItem) { - if (mapArrayAnytypeItem != null && this.mapArrayAnytype != null) { - this.mapArrayAnytype.remove(mapArrayAnytypeItem); + public AdditionalPropertiesClass removeMapArrayAnytypeItem(String key) { + if (this.mapArrayAnytype != null) { + this.mapArrayAnytype.remove(key); } return this; @@ -272,9 +272,9 @@ public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { - if (mapMapStringItem != null && this.mapMapString != null) { - this.mapMapString.remove(mapMapStringItem); + public AdditionalPropertiesClass removeMapMapStringItem(String key) { + if (this.mapMapString != null) { + this.mapMapString.remove(key); } return this; @@ -307,9 +307,9 @@ public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { - if (mapMapAnytypeItem != null && this.mapMapAnytype != null) { - this.mapMapAnytype.remove(mapMapAnytypeItem); + public AdditionalPropertiesClass removeMapMapAnytypeItem(String key) { + if (this.mapMapAnytype != null) { + this.mapMapAnytype.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MapTest.java index f7ee3c1a06c1..64bc36f62ea0 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MapTest.java @@ -100,9 +100,9 @@ public MapTest putMapMapOfStringItem(String key, Map mapMapOfStr return this; } - public MapTest removeMapMapOfStringItem(Map mapMapOfStringItem) { - if (mapMapOfStringItem != null && this.mapMapOfString != null) { - this.mapMapOfString.remove(mapMapOfStringItem); + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); } return this; @@ -135,9 +135,9 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) return this; } - public MapTest removeMapOfEnumStringItem(InnerEnum mapOfEnumStringItem) { - if (mapOfEnumStringItem != null && this.mapOfEnumString != null) { - this.mapOfEnumString.remove(mapOfEnumStringItem); + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); } return this; @@ -170,9 +170,9 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { return this; } - public MapTest removeDirectMapItem(Boolean directMapItem) { - if (directMapItem != null && this.directMap != null) { - this.directMap.remove(directMapItem); + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); } return this; @@ -205,9 +205,9 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { return this; } - public MapTest removeIndirectMapItem(Boolean indirectMapItem) { - if (indirectMapItem != null && this.indirectMap != null) { - this.indirectMap.remove(indirectMapItem); + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 0512e4ada08e..c4c9a00d5ff2 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -93,9 +93,9 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal return this; } - public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(Animal mapItem) { - if (mapItem != null && this.map != null) { - this.map.remove(mapItem); + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-interface/pom.xml b/samples/server/petstore/jaxrs-spec-interface/pom.xml index b614cca47966..f9ac6496192a 100644 --- a/samples/server/petstore/jaxrs-spec-interface/pom.xml +++ b/samples/server/petstore/jaxrs-spec-interface/pom.xml @@ -88,6 +88,11 @@ ${beanvalidation-version} provided + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + 1.8 @@ -100,5 +105,6 @@ 1.3.2 2.0.2 2.1.6 + 0.2.6 diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index e201adcaa78a..32f5151d7854 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -62,9 +62,9 @@ public AdditionalPropertiesClass putMapStringItem(String key, String mapStringIt return this; } - public AdditionalPropertiesClass removeMapStringItem(String mapStringItem) { - if (mapStringItem != null && this.mapString != null) { - this.mapString.remove(mapStringItem); + public AdditionalPropertiesClass removeMapStringItem(String key) { + if (this.mapString != null) { + this.mapString.remove(key); } return this; @@ -97,9 +97,9 @@ public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumb return this; } - public AdditionalPropertiesClass removeMapNumberItem(BigDecimal mapNumberItem) { - if (mapNumberItem != null && this.mapNumber != null) { - this.mapNumber.remove(mapNumberItem); + public AdditionalPropertiesClass removeMapNumberItem(String key) { + if (this.mapNumber != null) { + this.mapNumber.remove(key); } return this; @@ -132,9 +132,9 @@ public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntege return this; } - public AdditionalPropertiesClass removeMapIntegerItem(Integer mapIntegerItem) { - if (mapIntegerItem != null && this.mapInteger != null) { - this.mapInteger.remove(mapIntegerItem); + public AdditionalPropertiesClass removeMapIntegerItem(String key) { + if (this.mapInteger != null) { + this.mapInteger.remove(key); } return this; @@ -167,9 +167,9 @@ public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBoolea return this; } - public AdditionalPropertiesClass removeMapBooleanItem(Boolean mapBooleanItem) { - if (mapBooleanItem != null && this.mapBoolean != null) { - this.mapBoolean.remove(mapBooleanItem); + public AdditionalPropertiesClass removeMapBooleanItem(String key) { + if (this.mapBoolean != null) { + this.mapBoolean.remove(key); } return this; @@ -202,9 +202,9 @@ public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { - if (mapArrayIntegerItem != null && this.mapArrayInteger != null) { - this.mapArrayInteger.remove(mapArrayIntegerItem); + public AdditionalPropertiesClass removeMapArrayIntegerItem(String key) { + if (this.mapArrayInteger != null) { + this.mapArrayInteger.remove(key); } return this; @@ -237,9 +237,9 @@ public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List return this; } - public AdditionalPropertiesClass removeMapArrayAnytypeItem(List mapArrayAnytypeItem) { - if (mapArrayAnytypeItem != null && this.mapArrayAnytype != null) { - this.mapArrayAnytype.remove(mapArrayAnytypeItem); + public AdditionalPropertiesClass removeMapArrayAnytypeItem(String key) { + if (this.mapArrayAnytype != null) { + this.mapArrayAnytype.remove(key); } return this; @@ -272,9 +272,9 @@ public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { - if (mapMapStringItem != null && this.mapMapString != null) { - this.mapMapString.remove(mapMapStringItem); + public AdditionalPropertiesClass removeMapMapStringItem(String key) { + if (this.mapMapString != null) { + this.mapMapString.remove(key); } return this; @@ -307,9 +307,9 @@ public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { - if (mapMapAnytypeItem != null && this.mapMapAnytype != null) { - this.mapMapAnytype.remove(mapMapAnytypeItem); + public AdditionalPropertiesClass removeMapMapAnytypeItem(String key) { + if (this.mapMapAnytype != null) { + this.mapMapAnytype.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MapTest.java index f7ee3c1a06c1..64bc36f62ea0 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MapTest.java @@ -100,9 +100,9 @@ public MapTest putMapMapOfStringItem(String key, Map mapMapOfStr return this; } - public MapTest removeMapMapOfStringItem(Map mapMapOfStringItem) { - if (mapMapOfStringItem != null && this.mapMapOfString != null) { - this.mapMapOfString.remove(mapMapOfStringItem); + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); } return this; @@ -135,9 +135,9 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) return this; } - public MapTest removeMapOfEnumStringItem(InnerEnum mapOfEnumStringItem) { - if (mapOfEnumStringItem != null && this.mapOfEnumString != null) { - this.mapOfEnumString.remove(mapOfEnumStringItem); + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); } return this; @@ -170,9 +170,9 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { return this; } - public MapTest removeDirectMapItem(Boolean directMapItem) { - if (directMapItem != null && this.directMap != null) { - this.directMap.remove(directMapItem); + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); } return this; @@ -205,9 +205,9 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { return this; } - public MapTest removeIndirectMapItem(Boolean indirectMapItem) { - if (indirectMapItem != null && this.indirectMap != null) { - this.indirectMap.remove(indirectMapItem); + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 0512e4ada08e..c4c9a00d5ff2 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -93,9 +93,9 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal return this; } - public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(Animal mapItem) { - if (mapItem != null && this.map != null) { - this.map.remove(mapItem); + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-jakarta/pom.xml b/samples/server/petstore/jaxrs-spec-jakarta/pom.xml index 6012c2602778..0d0ce11b1b31 100644 --- a/samples/server/petstore/jaxrs-spec-jakarta/pom.xml +++ b/samples/server/petstore/jaxrs-spec-jakarta/pom.xml @@ -123,6 +123,11 @@ ${beanvalidation-version} provided + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + 1.8 @@ -135,5 +140,6 @@ 2.1.1 3.0.2 3.1.0 + 0.2.6 diff --git a/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index a2183d6eefbc..392db2756bb7 100644 --- a/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -79,9 +79,9 @@ public AdditionalPropertiesClass putMapStringItem(String key, String mapStringIt return this; } - public AdditionalPropertiesClass removeMapStringItem(String mapStringItem) { - if (mapStringItem != null && this.mapString != null) { - this.mapString.remove(mapStringItem); + public AdditionalPropertiesClass removeMapStringItem(String key) { + if (this.mapString != null) { + this.mapString.remove(key); } return this; @@ -114,9 +114,9 @@ public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumb return this; } - public AdditionalPropertiesClass removeMapNumberItem(BigDecimal mapNumberItem) { - if (mapNumberItem != null && this.mapNumber != null) { - this.mapNumber.remove(mapNumberItem); + public AdditionalPropertiesClass removeMapNumberItem(String key) { + if (this.mapNumber != null) { + this.mapNumber.remove(key); } return this; @@ -149,9 +149,9 @@ public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntege return this; } - public AdditionalPropertiesClass removeMapIntegerItem(Integer mapIntegerItem) { - if (mapIntegerItem != null && this.mapInteger != null) { - this.mapInteger.remove(mapIntegerItem); + public AdditionalPropertiesClass removeMapIntegerItem(String key) { + if (this.mapInteger != null) { + this.mapInteger.remove(key); } return this; @@ -184,9 +184,9 @@ public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBoolea return this; } - public AdditionalPropertiesClass removeMapBooleanItem(Boolean mapBooleanItem) { - if (mapBooleanItem != null && this.mapBoolean != null) { - this.mapBoolean.remove(mapBooleanItem); + public AdditionalPropertiesClass removeMapBooleanItem(String key) { + if (this.mapBoolean != null) { + this.mapBoolean.remove(key); } return this; @@ -219,9 +219,9 @@ public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { - if (mapArrayIntegerItem != null && this.mapArrayInteger != null) { - this.mapArrayInteger.remove(mapArrayIntegerItem); + public AdditionalPropertiesClass removeMapArrayIntegerItem(String key) { + if (this.mapArrayInteger != null) { + this.mapArrayInteger.remove(key); } return this; @@ -254,9 +254,9 @@ public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List return this; } - public AdditionalPropertiesClass removeMapArrayAnytypeItem(List mapArrayAnytypeItem) { - if (mapArrayAnytypeItem != null && this.mapArrayAnytype != null) { - this.mapArrayAnytype.remove(mapArrayAnytypeItem); + public AdditionalPropertiesClass removeMapArrayAnytypeItem(String key) { + if (this.mapArrayAnytype != null) { + this.mapArrayAnytype.remove(key); } return this; @@ -289,9 +289,9 @@ public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { - if (mapMapStringItem != null && this.mapMapString != null) { - this.mapMapString.remove(mapMapStringItem); + public AdditionalPropertiesClass removeMapMapStringItem(String key) { + if (this.mapMapString != null) { + this.mapMapString.remove(key); } return this; @@ -324,9 +324,9 @@ public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { - if (mapMapAnytypeItem != null && this.mapMapAnytype != null) { - this.mapMapAnytype.remove(mapMapAnytypeItem); + public AdditionalPropertiesClass removeMapMapAnytypeItem(String key) { + if (this.mapMapAnytype != null) { + this.mapMapAnytype.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/MapTest.java index 3ba71c91ad2f..122c85e310fc 100644 --- a/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/MapTest.java @@ -110,9 +110,9 @@ public MapTest putMapMapOfStringItem(String key, Map mapMapOfStr return this; } - public MapTest removeMapMapOfStringItem(Map mapMapOfStringItem) { - if (mapMapOfStringItem != null && this.mapMapOfString != null) { - this.mapMapOfString.remove(mapMapOfStringItem); + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); } return this; @@ -145,9 +145,9 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) return this; } - public MapTest removeMapOfEnumStringItem(InnerEnum mapOfEnumStringItem) { - if (mapOfEnumStringItem != null && this.mapOfEnumString != null) { - this.mapOfEnumString.remove(mapOfEnumStringItem); + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); } return this; @@ -180,9 +180,9 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { return this; } - public MapTest removeDirectMapItem(Boolean directMapItem) { - if (directMapItem != null && this.directMap != null) { - this.directMap.remove(directMapItem); + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); } return this; @@ -215,9 +215,9 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { return this; } - public MapTest removeIndirectMapItem(Boolean indirectMapItem) { - if (indirectMapItem != null && this.indirectMap != null) { - this.indirectMap.remove(indirectMapItem); + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 404382c42257..d98c553377ff 100644 --- a/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -102,9 +102,9 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal return this; } - public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(Animal mapItem) { - if (mapItem != null && this.map != null) { - this.map.remove(mapItem); + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index c3aaf7236b73..668f212ff26f 100644 --- a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -77,9 +77,9 @@ public AdditionalPropertiesClass putMapStringItem(String key, String mapStringIt return this; } - public AdditionalPropertiesClass removeMapStringItem(String mapStringItem) { - if (mapStringItem != null && this.mapString != null) { - this.mapString.remove(mapStringItem); + public AdditionalPropertiesClass removeMapStringItem(String key) { + if (this.mapString != null) { + this.mapString.remove(key); } return this; @@ -112,9 +112,9 @@ public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumb return this; } - public AdditionalPropertiesClass removeMapNumberItem(BigDecimal mapNumberItem) { - if (mapNumberItem != null && this.mapNumber != null) { - this.mapNumber.remove(mapNumberItem); + public AdditionalPropertiesClass removeMapNumberItem(String key) { + if (this.mapNumber != null) { + this.mapNumber.remove(key); } return this; @@ -147,9 +147,9 @@ public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntege return this; } - public AdditionalPropertiesClass removeMapIntegerItem(Integer mapIntegerItem) { - if (mapIntegerItem != null && this.mapInteger != null) { - this.mapInteger.remove(mapIntegerItem); + public AdditionalPropertiesClass removeMapIntegerItem(String key) { + if (this.mapInteger != null) { + this.mapInteger.remove(key); } return this; @@ -182,9 +182,9 @@ public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBoolea return this; } - public AdditionalPropertiesClass removeMapBooleanItem(Boolean mapBooleanItem) { - if (mapBooleanItem != null && this.mapBoolean != null) { - this.mapBoolean.remove(mapBooleanItem); + public AdditionalPropertiesClass removeMapBooleanItem(String key) { + if (this.mapBoolean != null) { + this.mapBoolean.remove(key); } return this; @@ -217,9 +217,9 @@ public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { - if (mapArrayIntegerItem != null && this.mapArrayInteger != null) { - this.mapArrayInteger.remove(mapArrayIntegerItem); + public AdditionalPropertiesClass removeMapArrayIntegerItem(String key) { + if (this.mapArrayInteger != null) { + this.mapArrayInteger.remove(key); } return this; @@ -252,9 +252,9 @@ public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List return this; } - public AdditionalPropertiesClass removeMapArrayAnytypeItem(List mapArrayAnytypeItem) { - if (mapArrayAnytypeItem != null && this.mapArrayAnytype != null) { - this.mapArrayAnytype.remove(mapArrayAnytypeItem); + public AdditionalPropertiesClass removeMapArrayAnytypeItem(String key) { + if (this.mapArrayAnytype != null) { + this.mapArrayAnytype.remove(key); } return this; @@ -287,9 +287,9 @@ public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { - if (mapMapStringItem != null && this.mapMapString != null) { - this.mapMapString.remove(mapMapStringItem); + public AdditionalPropertiesClass removeMapMapStringItem(String key) { + if (this.mapMapString != null) { + this.mapMapString.remove(key); } return this; @@ -322,9 +322,9 @@ public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { - if (mapMapAnytypeItem != null && this.mapMapAnytype != null) { - this.mapMapAnytype.remove(mapMapAnytypeItem); + public AdditionalPropertiesClass removeMapMapAnytypeItem(String key) { + if (this.mapMapAnytype != null) { + this.mapMapAnytype.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/MapTest.java index 3961592e4649..8950d97f4b1f 100644 --- a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/MapTest.java @@ -108,9 +108,9 @@ public MapTest putMapMapOfStringItem(String key, Map mapMapOfStr return this; } - public MapTest removeMapMapOfStringItem(Map mapMapOfStringItem) { - if (mapMapOfStringItem != null && this.mapMapOfString != null) { - this.mapMapOfString.remove(mapMapOfStringItem); + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); } return this; @@ -143,9 +143,9 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) return this; } - public MapTest removeMapOfEnumStringItem(InnerEnum mapOfEnumStringItem) { - if (mapOfEnumStringItem != null && this.mapOfEnumString != null) { - this.mapOfEnumString.remove(mapOfEnumStringItem); + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); } return this; @@ -178,9 +178,9 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { return this; } - public MapTest removeDirectMapItem(Boolean directMapItem) { - if (directMapItem != null && this.directMap != null) { - this.directMap.remove(directMapItem); + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); } return this; @@ -213,9 +213,9 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { return this; } - public MapTest removeIndirectMapItem(Boolean indirectMapItem) { - if (indirectMapItem != null && this.indirectMap != null) { - this.indirectMap.remove(indirectMapItem); + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index e176a7bd1c26..2eb166e84866 100644 --- a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -100,9 +100,9 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal return this; } - public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(Animal mapItem) { - if (mapItem != null && this.map != null) { - this.map.remove(mapItem); + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index d7012c8b89da..f30a921499b4 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -57,9 +57,9 @@ public AdditionalPropertiesClass putMapPropertyItem(String key, String mapProper return this; } - public AdditionalPropertiesClass removeMapPropertyItem(String mapPropertyItem) { - if (mapPropertyItem != null && this.mapProperty != null) { - this.mapProperty.remove(mapPropertyItem); + public AdditionalPropertiesClass removeMapPropertyItem(String key) { + if (this.mapProperty != null) { + this.mapProperty.remove(key); } return this; @@ -92,9 +92,9 @@ public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { - if (mapOfMapPropertyItem != null && this.mapOfMapProperty != null) { - this.mapOfMapProperty.remove(mapOfMapPropertyItem); + public AdditionalPropertiesClass removeMapOfMapPropertyItem(String key) { + if (this.mapOfMapProperty != null) { + this.mapOfMapProperty.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java index 8e5f240417c6..e1b6e19bb3e5 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java @@ -78,9 +78,9 @@ public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMa return this; } - public FakeBigDecimalMap200Response removeSomeMapItem(BigDecimal someMapItem) { - if (someMapItem != null && this.someMap != null) { - this.someMap.remove(someMapItem); + public FakeBigDecimalMap200Response removeSomeMapItem(String key) { + if (this.someMap != null) { + this.someMap.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/MapTest.java index 3961592e4649..8950d97f4b1f 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/MapTest.java @@ -108,9 +108,9 @@ public MapTest putMapMapOfStringItem(String key, Map mapMapOfStr return this; } - public MapTest removeMapMapOfStringItem(Map mapMapOfStringItem) { - if (mapMapOfStringItem != null && this.mapMapOfString != null) { - this.mapMapOfString.remove(mapMapOfStringItem); + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); } return this; @@ -143,9 +143,9 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) return this; } - public MapTest removeMapOfEnumStringItem(InnerEnum mapOfEnumStringItem) { - if (mapOfEnumStringItem != null && this.mapOfEnumString != null) { - this.mapOfEnumString.remove(mapOfEnumStringItem); + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); } return this; @@ -178,9 +178,9 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { return this; } - public MapTest removeDirectMapItem(Boolean directMapItem) { - if (directMapItem != null && this.directMap != null) { - this.directMap.remove(directMapItem); + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); } return this; @@ -213,9 +213,9 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { return this; } - public MapTest removeIndirectMapItem(Boolean indirectMapItem) { - if (indirectMapItem != null && this.indirectMap != null) { - this.indirectMap.remove(indirectMapItem); + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index e176a7bd1c26..2eb166e84866 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -100,9 +100,9 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal return this; } - public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(Animal mapItem) { - if (mapItem != null && this.map != null) { - this.map.remove(mapItem); + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/NullableClass.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/NullableClass.java index e1c1b203bfbd..a354ca5e6794 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/NullableClass.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/NullableClass.java @@ -285,9 +285,9 @@ public NullableClass putObjectNullablePropItem(String key, Object objectNullable return this; } - public NullableClass removeObjectNullablePropItem(Object objectNullablePropItem) { - if (objectNullablePropItem != null && this.objectNullableProp != null) { - this.objectNullableProp.remove(objectNullablePropItem); + public NullableClass removeObjectNullablePropItem(String key) { + if (this.objectNullableProp != null) { + this.objectNullableProp.remove(key); } return this; @@ -320,9 +320,9 @@ public NullableClass putObjectAndItemsNullablePropItem(String key, Object object return this; } - public NullableClass removeObjectAndItemsNullablePropItem(Object objectAndItemsNullablePropItem) { - if (objectAndItemsNullablePropItem != null && this.objectAndItemsNullableProp != null) { - this.objectAndItemsNullableProp.remove(objectAndItemsNullablePropItem); + public NullableClass removeObjectAndItemsNullablePropItem(String key) { + if (this.objectAndItemsNullableProp != null) { + this.objectAndItemsNullableProp.remove(key); } return this; @@ -355,9 +355,9 @@ public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNu return this; } - public NullableClass removeObjectItemsNullableItem(Object objectItemsNullableItem) { - if (objectItemsNullableItem != null && this.objectItemsNullable != null) { - this.objectItemsNullable.remove(objectItemsNullableItem); + public NullableClass removeObjectItemsNullableItem(String key) { + if (this.objectItemsNullable != null) { + this.objectItemsNullable.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec-required-and-readonly-property/pom.xml b/samples/server/petstore/jaxrs-spec-required-and-readonly-property/pom.xml index 031d2beeafb0..0cd16dc39fd8 100644 --- a/samples/server/petstore/jaxrs-spec-required-and-readonly-property/pom.xml +++ b/samples/server/petstore/jaxrs-spec-required-and-readonly-property/pom.xml @@ -123,6 +123,11 @@ ${beanvalidation-version} provided + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + 1.8 @@ -135,5 +140,6 @@ 1.3.2 2.0.2 2.1.6 + 0.2.6 diff --git a/samples/server/petstore/jaxrs-spec/.openapi-generator/FILES b/samples/server/petstore/jaxrs-spec/.openapi-generator/FILES index 3ed6ff4d23c0..6576c008a879 100644 --- a/samples/server/petstore/jaxrs-spec/.openapi-generator/FILES +++ b/samples/server/petstore/jaxrs-spec/.openapi-generator/FILES @@ -3,36 +3,36 @@ pom.xml src/gen/java/org/openapitools/api/AnotherFakeApi.java src/gen/java/org/openapitools/api/FakeApi.java src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +src/gen/java/org/openapitools/api/FooApi.java src/gen/java/org/openapitools/api/PetApi.java src/gen/java/org/openapitools/api/RestApplication.java src/gen/java/org/openapitools/api/RestResourceRoot.java src/gen/java/org/openapitools/api/StoreApi.java src/gen/java/org/openapitools/api/UserApi.java -src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java -src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java -src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java -src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java -src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java -src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java -src/gen/java/org/openapitools/model/AdditionalPropertiesString.java +src/gen/java/org/openapitools/model/AllOfWithSingleRef.java src/gen/java/org/openapitools/model/Animal.java src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java src/gen/java/org/openapitools/model/ArrayTest.java -src/gen/java/org/openapitools/model/BigCat.java src/gen/java/org/openapitools/model/Capitalization.java src/gen/java/org/openapitools/model/Cat.java src/gen/java/org/openapitools/model/Category.java +src/gen/java/org/openapitools/model/ChildWithNullable.java src/gen/java/org/openapitools/model/ClassModel.java src/gen/java/org/openapitools/model/Client.java +src/gen/java/org/openapitools/model/DeprecatedObject.java src/gen/java/org/openapitools/model/Dog.java src/gen/java/org/openapitools/model/EnumArrays.java src/gen/java/org/openapitools/model/EnumClass.java src/gen/java/org/openapitools/model/EnumTest.java +src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java src/gen/java/org/openapitools/model/FileSchemaTestClass.java +src/gen/java/org/openapitools/model/Foo.java +src/gen/java/org/openapitools/model/FooGetDefaultResponse.java src/gen/java/org/openapitools/model/FormatTest.java src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +src/gen/java/org/openapitools/model/HealthCheckResult.java src/gen/java/org/openapitools/model/MapTest.java src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java src/gen/java/org/openapitools/model/Model200Response.java @@ -41,16 +41,22 @@ src/gen/java/org/openapitools/model/ModelFile.java src/gen/java/org/openapitools/model/ModelList.java src/gen/java/org/openapitools/model/ModelReturn.java src/gen/java/org/openapitools/model/Name.java +src/gen/java/org/openapitools/model/NullableClass.java src/gen/java/org/openapitools/model/NumberOnly.java +src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java src/gen/java/org/openapitools/model/Order.java src/gen/java/org/openapitools/model/OuterComposite.java src/gen/java/org/openapitools/model/OuterEnum.java +src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java +src/gen/java/org/openapitools/model/OuterEnumInteger.java +src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java +src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java +src/gen/java/org/openapitools/model/ParentWithNullable.java src/gen/java/org/openapitools/model/Pet.java src/gen/java/org/openapitools/model/ReadOnlyFirst.java +src/gen/java/org/openapitools/model/SingleRefType.java src/gen/java/org/openapitools/model/SpecialModelName.java src/gen/java/org/openapitools/model/Tag.java -src/gen/java/org/openapitools/model/TypeHolderDefault.java -src/gen/java/org/openapitools/model/TypeHolderExample.java +src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java src/gen/java/org/openapitools/model/User.java -src/gen/java/org/openapitools/model/XmlItem.java src/main/openapi/openapi.yaml diff --git a/samples/server/petstore/jaxrs-spec/pom.xml b/samples/server/petstore/jaxrs-spec/pom.xml index 031d2beeafb0..0cd16dc39fd8 100644 --- a/samples/server/petstore/jaxrs-spec/pom.xml +++ b/samples/server/petstore/jaxrs-spec/pom.xml @@ -123,6 +123,11 @@ ${beanvalidation-version} provided + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + 1.8 @@ -135,5 +140,6 @@ 1.3.2 2.0.2 2.1.6 + 0.2.6 diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/AnotherFakeApi.java index 5a40b56eef48..403d1a84a917 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -1,7 +1,6 @@ package org.openapitools.api; import org.openapitools.model.Client; -import java.util.UUID; import javax.ws.rs.*; import javax.ws.rs.core.Response; @@ -29,7 +28,7 @@ public class AnotherFakeApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response call123testSpecialTags(@HeaderParam("uuid_test") @NotNull @ApiParam("to test uuid example value") UUID uuidTest,@Valid @NotNull Client body) { + public Response call123testSpecialTags(@Valid @NotNull Client client) { return Response.ok().entity("magic!").build(); } } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeApi.java index c4bac86519ba..1bc3632286b0 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeApi.java @@ -1,16 +1,22 @@ package org.openapitools.api; import java.math.BigDecimal; +import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; import java.util.Date; +import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; import org.joda.time.LocalDate; import java.util.Map; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; +import org.openapitools.model.OuterObjectWithEnumProperty; +import org.openapitools.model.Pet; +import org.openapitools.model.TestInlineFreeformAdditionalPropertiesRequest; import org.openapitools.model.User; -import org.openapitools.model.XmlItem; import javax.ws.rs.*; import javax.ws.rs.core.Response; @@ -31,19 +37,45 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class FakeApi { - @POST - @Path("/create_xml_item") - @Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" }) - @ApiOperation(value = "creates an XmlItem", notes = "this route creates an XmlItem", response = Void.class, tags={ "fake" }) + @GET + @Path("/BigDecimalMap") + @Produces({ "*/*" }) + @ApiOperation(value = "", notes = "for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys", response = FakeBigDecimalMap200Response.class, tags={ "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Void.class) + @ApiResponse(code = 200, message = "successful operation", response = FakeBigDecimalMap200Response.class) + }) + public Response fakeBigDecimalMap() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/health") + @Produces({ "application/json" }) + @ApiOperation(value = "Health check endpoint", notes = "", response = HealthCheckResult.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "The instance started successfully", response = HealthCheckResult.class) + }) + public Response fakeHealthGet() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/http-signature-test") + @Consumes({ "application/json", "application/xml" }) + @ApiOperation(value = "test http signature authentication", notes = "", response = Void.class, authorizations = { + + @Authorization(value = "http_signature_test") + }, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "The instance started successfully", response = Void.class) }) - public Response createXmlItem(@Valid @NotNull XmlItem xmlItem) { + public Response fakeHttpSignatureTest(@Valid @NotNull Pet pet,@QueryParam("query_1") @ApiParam("query parameter") String query1,@HeaderParam("header_1") @ApiParam("header parameter") String header1) { return Response.ok().entity("magic!").build(); } @POST @Path("/outer/boolean") + @Consumes({ "application/json" }) @Produces({ "*/*" }) @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake" }) @ApiResponses(value = { @@ -55,17 +87,19 @@ public Response fakeOuterBooleanSerialize(@Valid Boolean body) { @POST @Path("/outer/composite") + @Consumes({ "application/json" }) @Produces({ "*/*" }) @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) - public Response fakeOuterCompositeSerialize(@Valid OuterComposite body) { + public Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite) { return Response.ok().entity("magic!").build(); } @POST @Path("/outer/number") + @Consumes({ "application/json" }) @Produces({ "*/*" }) @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake" }) @ApiResponses(value = { @@ -77,6 +111,7 @@ public Response fakeOuterNumberSerialize(@Valid BigDecimal body) { @POST @Path("/outer/string") + @Consumes({ "application/json" }) @Produces({ "*/*" }) @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake" }) @ApiResponses(value = { @@ -86,14 +121,48 @@ public Response fakeOuterStringSerialize(@Valid String body) { return Response.ok().entity("magic!").build(); } + @POST + @Path("/property/enum-int") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", notes = "Test serialization of enum (int) properties with examples", response = OuterObjectWithEnumProperty.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output enum (int)", response = OuterObjectWithEnumProperty.class) + }) + public Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + @ApiOperation(value = "test referenced additionalProperties", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testAdditionalPropertiesReference(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-binary") + @Consumes({ "image/png" }) + @ApiOperation(value = "", notes = "For this test, the body has to be a binary file.", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success", response = Void.class) + }) + public Response testBodyWithBinary(@Valid File body) { + return Response.ok().entity("magic!").build(); + } + @PUT @Path("/body-with-file-schema") @Consumes({ "application/json" }) - @ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake" }) + @ApiOperation(value = "", notes = "For this test, the body for this request must reference a schema named `File`.", response = Void.class, tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = Void.class) }) - public Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass body) { + public Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass fileSchemaTestClass) { return Response.ok().entity("magic!").build(); } @@ -104,7 +173,7 @@ public Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass body) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = Void.class) }) - public Response testBodyWithQueryParams(@QueryParam("query") @NotNull String query,@Valid @NotNull User body) { + public Response testBodyWithQueryParams(@QueryParam("query") @NotNull String query,@Valid @NotNull User user) { return Response.ok().entity("magic!").build(); } @@ -115,13 +184,13 @@ public Response testBodyWithQueryParams(@QueryParam("query") @NotNull String q @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testClientModel(@Valid @NotNull Client body) { + public Response testClientModel(@Valid @NotNull Client client) { return Response.ok().entity("magic!").build(); } @POST @Consumes({ "application/x-www-form-urlencoded" }) - @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", response = Void.class, authorizations = { + @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @Authorization(value = "http_basic_test") }, tags={ "fake" }) @@ -143,12 +212,15 @@ public Response testEndpointParameters(@FormParam(value = "number") BigDecimal @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) - public Response testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) { + public Response testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@QueryParam("enum_query_model_array") List enumQueryModelArray,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) { return Response.ok().entity("magic!").build(); } @DELETE - @ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", response = Void.class, tags={ "fake" }) + @ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", response = Void.class, authorizations = { + + @Authorization(value = "bearer_test") + }, tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Something wrong", response = Void.class) }) @@ -163,7 +235,18 @@ public Response testGroupParameters(@QueryParam("required_string_group") @NotNul @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testInlineAdditionalProperties(@Valid @NotNull Map param) { + public Response testInlineAdditionalProperties(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/inline-freeform-additionalProperties") + @Consumes({ "application/json" }) + @ApiOperation(value = "test inline free-form additionalProperties", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testInlineFreeformAdditionalProperties(@Valid @NotNull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) { return Response.ok().entity("magic!").build(); } @@ -178,13 +261,35 @@ public Response testJsonFormData(@FormParam(value = "param") String param,@Form return Response.ok().entity("magic!").build(); } + @POST + @Path("/nullable") + @Consumes({ "application/json" }) + @ApiOperation(value = "test nullable parent property", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testNullable(@Valid @NotNull ChildWithNullable childWithNullable) { + return Response.ok().entity("magic!").build(); + } + @PUT @Path("/test-query-parameters") @ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = Void.class) }) - public Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull List pipe,@QueryParam("ioutil") @NotNull List ioutil,@QueryParam("http") @NotNull List http,@QueryParam("url") @NotNull List url,@QueryParam("context") @NotNull List context) { + public Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull List pipe,@QueryParam("ioutil") @NotNull List ioutil,@QueryParam("http") @NotNull List http,@QueryParam("url") @NotNull List url,@QueryParam("context") @NotNull List context,@QueryParam("allowEmpty") @NotNull String allowEmpty,@QueryParam("language") Map language) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/stringMap-reference") + @Consumes({ "application/json" }) + @ApiOperation(value = "test referenced string map", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testStringMapReference(@Valid @NotNull Map requestBody) { return Response.ok().entity("magic!").build(); } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java index aa82ecdfecbc..df957b59d08b 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -31,7 +31,7 @@ public class FakeClassnameTestApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testClassname(@Valid @NotNull Client body) { + public Response testClassname(@Valid @NotNull Client client) { return Response.ok().entity("magic!").build(); } } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FooApi.java new file mode 100644 index 000000000000..e40e0d569c56 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FooApi.java @@ -0,0 +1,33 @@ +package org.openapitools.api; + +import org.openapitools.model.FooGetDefaultResponse; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/foo") +@Api(description = "the foo API") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class FooApi { + + @GET + @Produces({ "application/json" }) + @ApiOperation(value = "", notes = "", response = FooGetDefaultResponse.class, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "response", response = FooGetDefaultResponse.class) + }) + public Response fooGet() { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/PetApi.java index ad23a1b01138..8132bac1b846 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/PetApi.java @@ -32,10 +32,10 @@ public class PetApi { @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Void.class), + @ApiResponse(code = 200, message = "Successful operation", response = Void.class), @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@Valid @NotNull Pet body) { + public Response addPet(@Valid @NotNull Pet pet) { return Response.ok().entity("magic!").build(); } @@ -50,7 +50,7 @@ public Response addPet(@Valid @NotNull Pet body) { @io.swagger.annotations.ApiImplicitParam(name = "api_key", value = "", dataType = "String", paramType = "header") }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Void.class), + @ApiResponse(code = 200, message = "Successful operation", response = Void.class), @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) public Response deletePet(@PathParam("petId") @ApiParam("Pet id to delete") Long petId) { @@ -113,12 +113,12 @@ public Response getPetById(@PathParam("petId") @ApiParam("ID of pet to return") @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Void.class), + @ApiResponse(code = 200, message = "Successful operation", response = Void.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@Valid @NotNull Pet body) { + public Response updatePet(@Valid @NotNull Pet pet) { return Response.ok().entity("magic!").build(); } @@ -131,6 +131,7 @@ public Response updatePet(@Valid @NotNull Pet body) { @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet" }) @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation", response = Void.class), @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response updatePetWithForm(@PathParam("petId") @ApiParam("ID of pet that needs to be updated") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) { diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/StoreApi.java index 7ced493a15d8..820f4f223848 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/StoreApi.java @@ -62,13 +62,14 @@ public Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) @ApiParam( @POST @Path("/order") + @Consumes({ "application/json" }) @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@Valid @NotNull Order body) { + public Response placeOrder(@Valid @NotNull Order order) { return Response.ok().entity("magic!").build(); } } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/UserApi.java index af9989fdd516..292d2e1f84e5 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/UserApi.java @@ -23,31 +23,34 @@ public class UserApi { @POST + @Consumes({ "application/json" }) @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@Valid @NotNull User body) { + public Response createUser(@Valid @NotNull User user) { return Response.ok().entity("magic!").build(); } @POST @Path("/createWithArray") + @Consumes({ "application/json" }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@Valid @NotNull List<@Valid User> body) { + public Response createUsersWithArrayInput(@Valid @NotNull List<@Valid User> user) { return Response.ok().entity("magic!").build(); } @POST @Path("/createWithList") + @Consumes({ "application/json" }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@Valid @NotNull List<@Valid User> body) { + public Response createUsersWithListInput(@Valid @NotNull List<@Valid User> user) { return Response.ok().entity("magic!").build(); } @@ -99,12 +102,13 @@ public Response logoutUser() { @PUT @Path("/{username}") + @Consumes({ "application/json" }) @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response updateUser(@PathParam("username") @ApiParam("name that need to be deleted") String username,@Valid @NotNull User body) { + public Response updateUser(@PathParam("username") @ApiParam("name that need to be deleted") String username,@Valid @NotNull User user) { return Response.ok().entity("magic!").build(); } } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index 479ce7647b6c..2d6e2c04b1c7 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -2,9 +2,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.io.Serializable; import javax.validation.constraints.*; @@ -22,30 +20,12 @@ @JsonTypeName("AdditionalPropertiesClass") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class AdditionalPropertiesClass implements Serializable { - private @Valid Map mapString = new HashMap<>(); - private @Valid Map mapNumber = new HashMap<>(); - private @Valid Map mapInteger = new HashMap<>(); - private @Valid Map mapBoolean = new HashMap<>(); - private @Valid Map> mapArrayInteger = new HashMap<>(); - private @Valid Map> mapArrayAnytype = new HashMap<>(); - private @Valid Map> mapMapString = new HashMap<>(); - private @Valid Map> mapMapAnytype = new HashMap<>(); - private Object anytype1; - private Object anytype2; - private Object anytype3; + private @Valid Map mapProperty = new HashMap<>(); + private @Valid Map> mapOfMapProperty = new HashMap<>(); protected AdditionalPropertiesClass(AdditionalPropertiesClassBuilder b) { - this.mapString = b.mapString; - this.mapNumber = b.mapNumber; - this.mapInteger = b.mapInteger; - this.mapBoolean = b.mapBoolean; - this.mapArrayInteger = b.mapArrayInteger; - this.mapArrayAnytype = b.mapArrayAnytype; - this.mapMapString = b.mapMapString; - this.mapMapAnytype = b.mapMapAnytype; - this.anytype1 = b.anytype1; - this.anytype2 = b.anytype2; - this.anytype3 = b.anytype3; + this.mapProperty = b.mapProperty; + this.mapOfMapProperty = b.mapOfMapProperty; } public AdditionalPropertiesClass() { @@ -53,341 +33,74 @@ public AdditionalPropertiesClass() { /** **/ - public AdditionalPropertiesClass mapString(Map mapString) { - this.mapString = mapString; + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; return this; } @ApiModelProperty(value = "") - @JsonProperty("map_string") - public Map getMapString() { - return mapString; + @JsonProperty("map_property") + public Map getMapProperty() { + return mapProperty; } - @JsonProperty("map_string") - public void setMapString(Map mapString) { - this.mapString = mapString; + @JsonProperty("map_property") + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; } - public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { - if (this.mapString == null) { - this.mapString = new HashMap<>(); + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); } - this.mapString.put(key, mapStringItem); + this.mapProperty.put(key, mapPropertyItem); return this; } - public AdditionalPropertiesClass removeMapStringItem(String mapStringItem) { - if (mapStringItem != null && this.mapString != null) { - this.mapString.remove(mapStringItem); + public AdditionalPropertiesClass removeMapPropertyItem(String key) { + if (this.mapProperty != null) { + this.mapProperty.remove(key); } return this; } /** **/ - public AdditionalPropertiesClass mapNumber(Map mapNumber) { - this.mapNumber = mapNumber; + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; return this; } @ApiModelProperty(value = "") - @JsonProperty("map_number") - @Valid public Map getMapNumber() { - return mapNumber; + @JsonProperty("map_of_map_property") + @Valid public Map> getMapOfMapProperty() { + return mapOfMapProperty; } - @JsonProperty("map_number") - public void setMapNumber(Map mapNumber) { - this.mapNumber = mapNumber; + @JsonProperty("map_of_map_property") + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; } - public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { - if (this.mapNumber == null) { - this.mapNumber = new HashMap<>(); + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); } - this.mapNumber.put(key, mapNumberItem); + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); return this; } - public AdditionalPropertiesClass removeMapNumberItem(BigDecimal mapNumberItem) { - if (mapNumberItem != null && this.mapNumber != null) { - this.mapNumber.remove(mapNumberItem); + public AdditionalPropertiesClass removeMapOfMapPropertyItem(String key) { + if (this.mapOfMapProperty != null) { + this.mapOfMapProperty.remove(key); } return this; } - /** - **/ - public AdditionalPropertiesClass mapInteger(Map mapInteger) { - this.mapInteger = mapInteger; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("map_integer") - public Map getMapInteger() { - return mapInteger; - } - - @JsonProperty("map_integer") - public void setMapInteger(Map mapInteger) { - this.mapInteger = mapInteger; - } - - public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { - if (this.mapInteger == null) { - this.mapInteger = new HashMap<>(); - } - - this.mapInteger.put(key, mapIntegerItem); - return this; - } - - public AdditionalPropertiesClass removeMapIntegerItem(Integer mapIntegerItem) { - if (mapIntegerItem != null && this.mapInteger != null) { - this.mapInteger.remove(mapIntegerItem); - } - - return this; - } - /** - **/ - public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { - this.mapBoolean = mapBoolean; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("map_boolean") - public Map getMapBoolean() { - return mapBoolean; - } - - @JsonProperty("map_boolean") - public void setMapBoolean(Map mapBoolean) { - this.mapBoolean = mapBoolean; - } - - public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { - if (this.mapBoolean == null) { - this.mapBoolean = new HashMap<>(); - } - - this.mapBoolean.put(key, mapBooleanItem); - return this; - } - - public AdditionalPropertiesClass removeMapBooleanItem(Boolean mapBooleanItem) { - if (mapBooleanItem != null && this.mapBoolean != null) { - this.mapBoolean.remove(mapBooleanItem); - } - - return this; - } - /** - **/ - public AdditionalPropertiesClass mapArrayInteger(Map> mapArrayInteger) { - this.mapArrayInteger = mapArrayInteger; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("map_array_integer") - @Valid public Map> getMapArrayInteger() { - return mapArrayInteger; - } - - @JsonProperty("map_array_integer") - public void setMapArrayInteger(Map> mapArrayInteger) { - this.mapArrayInteger = mapArrayInteger; - } - - public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { - if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap<>(); - } - - this.mapArrayInteger.put(key, mapArrayIntegerItem); - return this; - } - - public AdditionalPropertiesClass removeMapArrayIntegerItem(List mapArrayIntegerItem) { - if (mapArrayIntegerItem != null && this.mapArrayInteger != null) { - this.mapArrayInteger.remove(mapArrayIntegerItem); - } - - return this; - } - /** - **/ - public AdditionalPropertiesClass mapArrayAnytype(Map> mapArrayAnytype) { - this.mapArrayAnytype = mapArrayAnytype; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("map_array_anytype") - @Valid public Map> getMapArrayAnytype() { - return mapArrayAnytype; - } - - @JsonProperty("map_array_anytype") - public void setMapArrayAnytype(Map> mapArrayAnytype) { - this.mapArrayAnytype = mapArrayAnytype; - } - - public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { - if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap<>(); - } - - this.mapArrayAnytype.put(key, mapArrayAnytypeItem); - return this; - } - - public AdditionalPropertiesClass removeMapArrayAnytypeItem(List mapArrayAnytypeItem) { - if (mapArrayAnytypeItem != null && this.mapArrayAnytype != null) { - this.mapArrayAnytype.remove(mapArrayAnytypeItem); - } - - return this; - } - /** - **/ - public AdditionalPropertiesClass mapMapString(Map> mapMapString) { - this.mapMapString = mapMapString; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("map_map_string") - @Valid public Map> getMapMapString() { - return mapMapString; - } - - @JsonProperty("map_map_string") - public void setMapMapString(Map> mapMapString) { - this.mapMapString = mapMapString; - } - - public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { - if (this.mapMapString == null) { - this.mapMapString = new HashMap<>(); - } - - this.mapMapString.put(key, mapMapStringItem); - return this; - } - - public AdditionalPropertiesClass removeMapMapStringItem(Map mapMapStringItem) { - if (mapMapStringItem != null && this.mapMapString != null) { - this.mapMapString.remove(mapMapStringItem); - } - - return this; - } - /** - **/ - public AdditionalPropertiesClass mapMapAnytype(Map> mapMapAnytype) { - this.mapMapAnytype = mapMapAnytype; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("map_map_anytype") - @Valid public Map> getMapMapAnytype() { - return mapMapAnytype; - } - - @JsonProperty("map_map_anytype") - public void setMapMapAnytype(Map> mapMapAnytype) { - this.mapMapAnytype = mapMapAnytype; - } - - public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { - if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap<>(); - } - - this.mapMapAnytype.put(key, mapMapAnytypeItem); - return this; - } - - public AdditionalPropertiesClass removeMapMapAnytypeItem(Map mapMapAnytypeItem) { - if (mapMapAnytypeItem != null && this.mapMapAnytype != null) { - this.mapMapAnytype.remove(mapMapAnytypeItem); - } - - return this; - } - /** - **/ - public AdditionalPropertiesClass anytype1(Object anytype1) { - this.anytype1 = anytype1; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("anytype_1") - public Object getAnytype1() { - return anytype1; - } - - @JsonProperty("anytype_1") - public void setAnytype1(Object anytype1) { - this.anytype1 = anytype1; - } - - /** - **/ - public AdditionalPropertiesClass anytype2(Object anytype2) { - this.anytype2 = anytype2; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("anytype_2") - public Object getAnytype2() { - return anytype2; - } - - @JsonProperty("anytype_2") - public void setAnytype2(Object anytype2) { - this.anytype2 = anytype2; - } - - /** - **/ - public AdditionalPropertiesClass anytype3(Object anytype3) { - this.anytype3 = anytype3; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("anytype_3") - public Object getAnytype3() { - return anytype3; - } - - @JsonProperty("anytype_3") - public void setAnytype3(Object anytype3) { - this.anytype3 = anytype3; - } - @Override public boolean equals(Object o) { @@ -398,22 +111,13 @@ public boolean equals(Object o) { return false; } AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; - return Objects.equals(this.mapString, additionalPropertiesClass.mapString) && - Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) && - Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) && - Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) && - Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) && - Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) && - Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) && - Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && - Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && - Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && - Objects.equals(this.anytype3, additionalPropertiesClass.anytype3); + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); } @Override public int hashCode() { - return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); + return Objects.hash(mapProperty, mapOfMapProperty); } @Override @@ -421,17 +125,8 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AdditionalPropertiesClass {\n"); - sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n"); - sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n"); - sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n"); - sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n"); - sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n"); - sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n"); - sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n"); - sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n"); - sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); - sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); - sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); sb.append("}"); return sb.toString(); } @@ -466,63 +161,18 @@ public AdditionalPropertiesClass build() { } public static abstract class AdditionalPropertiesClassBuilder> { - private Map mapString = new HashMap<>(); - private Map mapNumber = new HashMap<>(); - private Map mapInteger = new HashMap<>(); - private Map mapBoolean = new HashMap<>(); - private Map> mapArrayInteger = new HashMap<>(); - private Map> mapArrayAnytype = new HashMap<>(); - private Map> mapMapString = new HashMap<>(); - private Map> mapMapAnytype = new HashMap<>(); - private Object anytype1; - private Object anytype2; - private Object anytype3; + private Map mapProperty = new HashMap<>(); + private Map> mapOfMapProperty = new HashMap<>(); protected abstract B self(); public abstract C build(); - public B mapString(Map mapString) { - this.mapString = mapString; - return self(); - } - public B mapNumber(Map mapNumber) { - this.mapNumber = mapNumber; - return self(); - } - public B mapInteger(Map mapInteger) { - this.mapInteger = mapInteger; - return self(); - } - public B mapBoolean(Map mapBoolean) { - this.mapBoolean = mapBoolean; - return self(); - } - public B mapArrayInteger(Map> mapArrayInteger) { - this.mapArrayInteger = mapArrayInteger; - return self(); - } - public B mapArrayAnytype(Map> mapArrayAnytype) { - this.mapArrayAnytype = mapArrayAnytype; - return self(); - } - public B mapMapString(Map> mapMapString) { - this.mapMapString = mapMapString; - return self(); - } - public B mapMapAnytype(Map> mapMapAnytype) { - this.mapMapAnytype = mapMapAnytype; - return self(); - } - public B anytype1(Object anytype1) { - this.anytype1 = anytype1; - return self(); - } - public B anytype2(Object anytype2) { - this.anytype2 = anytype2; + public B mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; return self(); } - public B anytype3(Object anytype3) { - this.anytype3 = anytype3; + public B mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; return self(); } } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java deleted file mode 100644 index 3d2042de6967..000000000000 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.openapitools.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; -import java.io.Serializable; -import javax.validation.constraints.*; -import javax.validation.Valid; - -import io.swagger.annotations.*; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.annotation.JsonTypeName; - - - -@JsonTypeName("AdditionalPropertiesInteger") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class AdditionalPropertiesInteger extends HashMap implements Serializable { - private String name; - - /** - **/ - public AdditionalPropertiesInteger name(String name) { - this.name = name; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; - return Objects.equals(this.name, additionalPropertiesInteger.name) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(name, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesInteger {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - -} - diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java deleted file mode 100644 index a55d30c10fe0..000000000000 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.openapitools.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; -import java.util.HashMap; -import java.util.Map; -import java.io.Serializable; -import javax.validation.constraints.*; -import javax.validation.Valid; - -import io.swagger.annotations.*; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.annotation.JsonTypeName; - - - -@JsonTypeName("AdditionalPropertiesNumber") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class AdditionalPropertiesNumber extends HashMap implements Serializable { - private String name; - - /** - **/ - public AdditionalPropertiesNumber name(String name) { - this.name = name; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; - return Objects.equals(this.name, additionalPropertiesNumber.name) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(name, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesNumber {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - -} - diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java deleted file mode 100644 index f6547078d15e..000000000000 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.openapitools.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; -import java.io.Serializable; -import javax.validation.constraints.*; -import javax.validation.Valid; - -import io.swagger.annotations.*; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.annotation.JsonTypeName; - - - -@JsonTypeName("AdditionalPropertiesObject") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class AdditionalPropertiesObject extends HashMap implements Serializable { - private String name; - - /** - **/ - public AdditionalPropertiesObject name(String name) { - this.name = name; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; - return Objects.equals(this.name, additionalPropertiesObject.name) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(name, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesObject {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - -} - diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesString.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesString.java deleted file mode 100644 index 7136774e681b..000000000000 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesString.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.openapitools.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; -import java.io.Serializable; -import javax.validation.constraints.*; -import javax.validation.Valid; - -import io.swagger.annotations.*; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.annotation.JsonTypeName; - - - -@JsonTypeName("AdditionalPropertiesString") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class AdditionalPropertiesString extends HashMap implements Serializable { - private String name; - - /** - **/ - public AdditionalPropertiesString name(String name) { - this.name = name; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; - return Objects.equals(this.name, additionalPropertiesString.name) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(name, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesString {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - -} - diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java new file mode 100644 index 000000000000..0e658569ec06 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java @@ -0,0 +1,147 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.SingleRefType; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("AllOfWithSingleRef") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class AllOfWithSingleRef implements Serializable { + private String username; + private SingleRefType singleRefType; + + protected AllOfWithSingleRef(AllOfWithSingleRefBuilder b) { + this.username = b.username; + this.singleRefType = b.singleRefType; + } + + public AllOfWithSingleRef() { + } + + /** + **/ + public AllOfWithSingleRef username(String username) { + this.username = username; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonProperty("username") + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public AllOfWithSingleRef singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("SingleRefType") + @Valid public SingleRefType getSingleRefType() { + return singleRefType; + } + + @JsonProperty("SingleRefType") + public void setSingleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfWithSingleRef allOfWithSingleRef = (AllOfWithSingleRef) o; + return Objects.equals(this.username, allOfWithSingleRef.username) && + Objects.equals(this.singleRefType, allOfWithSingleRef.singleRefType); + } + + @Override + public int hashCode() { + return Objects.hash(username, singleRefType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfWithSingleRef {\n"); + + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" singleRefType: ").append(toIndentedString(singleRefType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AllOfWithSingleRefBuilder builder() { + return new AllOfWithSingleRefBuilderImpl(); + } + + private static final class AllOfWithSingleRefBuilderImpl extends AllOfWithSingleRefBuilder { + + @Override + protected AllOfWithSingleRefBuilderImpl self() { + return this; + } + + @Override + public AllOfWithSingleRef build() { + return new AllOfWithSingleRef(this); + } + } + + public static abstract class AllOfWithSingleRefBuilder> { + private String username; + private SingleRefType singleRefType; + protected abstract B self(); + + public abstract C build(); + + public B username(String username) { + this.username = username; + return self(); + } + public B singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java index 222f6afcdbac..323c1f7accf5 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java @@ -18,9 +18,8 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), - @JsonSubTypes.Type(value = Cat.class, name = "Cat"), - @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ArrayTest.java index ed002e0545f7..92d5bce485e8 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ArrayTest.java @@ -45,7 +45,7 @@ public ArrayTest arrayOfString(List arrayOfString) { @ApiModelProperty(value = "") @JsonProperty("array_of_string") - public List getArrayOfString() { + @Size(min=0,max=3)public List getArrayOfString() { return arrayOfString; } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCat.java deleted file mode 100644 index 86bd389b6932..000000000000 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCat.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.openapitools.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.openapitools.model.Cat; -import java.io.Serializable; -import javax.validation.constraints.*; -import javax.validation.Valid; - -import io.swagger.annotations.*; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.annotation.JsonTypeName; - - - -@JsonTypeName("BigCat") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class BigCat extends Cat implements Serializable { - public enum KindEnum { - - LIONS(String.valueOf("lions")), TIGERS(String.valueOf("tigers")), LEOPARDS(String.valueOf("leopards")), JAGUARS(String.valueOf("jaguars")); - - - private String value; - - KindEnum (String v) { - value = v; - } - - public String value() { - return value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - /** - * Convert a String into String, as specified in the - * See JAX RS 2.0 Specification, section 3.2, p. 12 - */ - public static KindEnum fromString(String s) { - for (KindEnum b : KindEnum.values()) { - // using Objects.toString() to be safe if value type non-object type - // because types like 'int' etc. will be auto-boxed - if (java.util.Objects.toString(b.value).equals(s)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected string value '" + s + "'"); - } - - @JsonCreator - public static KindEnum fromValue(String value) { - for (KindEnum b : KindEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } -} - - private KindEnum kind; - - protected BigCat(BigCatBuilder b) { - super(b); - this.kind = b.kind; - } - - public BigCat() { - } - - /** - **/ - public BigCat kind(KindEnum kind) { - this.kind = kind; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("kind") - public KindEnum getKind() { - return kind; - } - - @JsonProperty("kind") - public void setKind(KindEnum kind) { - this.kind = kind; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BigCat bigCat = (BigCat) o; - return Objects.equals(this.kind, bigCat.kind) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(kind, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BigCat {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static BigCatBuilder builder() { - return new BigCatBuilderImpl(); - } - - private static final class BigCatBuilderImpl extends BigCatBuilder { - - @Override - protected BigCatBuilderImpl self() { - return this; - } - - @Override - public BigCat build() { - return new BigCat(this); - } - } - - public static abstract class BigCatBuilder> extends CatBuilder { - private KindEnum kind; - - public B kind(KindEnum kind) { - this.kind = kind; - return self(); - } - } -} - diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ChildWithNullable.java new file mode 100644 index 000000000000..47f8f883fb28 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ChildWithNullable.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.model.ParentWithNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ChildWithNullable") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class ChildWithNullable extends ParentWithNullable implements Serializable { + private String otherProperty; + + protected ChildWithNullable(ChildWithNullableBuilder b) { + super(b); + this.otherProperty = b.otherProperty; + } + + public ChildWithNullable() { + } + + /** + **/ + public ChildWithNullable otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("otherProperty") + public String getOtherProperty() { + return otherProperty; + } + + @JsonProperty("otherProperty") + public void setOtherProperty(String otherProperty) { + this.otherProperty = otherProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChildWithNullable childWithNullable = (ChildWithNullable) o; + return Objects.equals(this.otherProperty, childWithNullable.otherProperty) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(otherProperty, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildWithNullable {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" otherProperty: ").append(toIndentedString(otherProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ChildWithNullableBuilder builder() { + return new ChildWithNullableBuilderImpl(); + } + + private static final class ChildWithNullableBuilderImpl extends ChildWithNullableBuilder { + + @Override + protected ChildWithNullableBuilderImpl self() { + return this; + } + + @Override + public ChildWithNullable build() { + return new ChildWithNullable(this); + } + } + + public static abstract class ChildWithNullableBuilder> extends ParentWithNullableBuilder { + private String otherProperty; + + public B otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/DeprecatedObject.java similarity index 57% rename from samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java rename to samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/DeprecatedObject.java index e937b773d0a6..081822cc8425 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/DeprecatedObject.java @@ -2,8 +2,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; import java.io.Serializable; import javax.validation.constraints.*; import javax.validation.Valid; @@ -17,14 +15,21 @@ -@JsonTypeName("AdditionalPropertiesBoolean") +@JsonTypeName("DeprecatedObject") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class AdditionalPropertiesBoolean extends HashMap implements Serializable { +public class DeprecatedObject implements Serializable { private String name; + protected DeprecatedObject(DeprecatedObjectBuilder b) { + this.name = b.name; + } + + public DeprecatedObject() { + } + /** **/ - public AdditionalPropertiesBoolean name(String name) { + public DeprecatedObject name(String name) { this.name = name; return this; } @@ -50,21 +55,20 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; - return Objects.equals(this.name, additionalPropertiesBoolean.name) && - super.equals(o); + DeprecatedObject deprecatedObject = (DeprecatedObject) o; + return Objects.equals(this.name, deprecatedObject.name); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(name); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesBoolean {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("class DeprecatedObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); return sb.toString(); @@ -82,5 +86,33 @@ private String toIndentedString(Object o) { } + public static DeprecatedObjectBuilder builder() { + return new DeprecatedObjectBuilderImpl(); + } + + private static final class DeprecatedObjectBuilderImpl extends DeprecatedObjectBuilder { + + @Override + protected DeprecatedObjectBuilderImpl self() { + return this; + } + + @Override + public DeprecatedObject build() { + return new DeprecatedObject(this); + } + } + + public static abstract class DeprecatedObjectBuilder> { + private String name; + protected abstract B self(); + + public abstract C build(); + + public B name(String name) { + this.name = name; + return self(); + } + } } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumTest.java index 9509cb5cfab4..7267cf713f7a 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumTest.java @@ -3,7 +3,11 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; import org.openapitools.model.OuterEnum; +import org.openapitools.model.OuterEnumDefaultValue; +import org.openapitools.model.OuterEnumInteger; +import org.openapitools.model.OuterEnumIntegerDefaultValue; import java.io.Serializable; import javax.validation.constraints.*; import javax.validation.Valid; @@ -213,6 +217,9 @@ public static EnumNumberEnum fromValue(Double value) { private EnumNumberEnum enumNumber; private OuterEnum outerEnum; + private OuterEnumInteger outerEnumInteger; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; protected EnumTest(EnumTestBuilder b) { this.enumString = b.enumString; @@ -220,6 +227,9 @@ protected EnumTest(EnumTestBuilder b) { this.enumInteger = b.enumInteger; this.enumNumber = b.enumNumber; this.outerEnum = b.outerEnum; + this.outerEnumInteger = b.outerEnumInteger; + this.outerEnumDefaultValue = b.outerEnumDefaultValue; + this.outerEnumIntegerDefaultValue = b.outerEnumIntegerDefaultValue; } public EnumTest() { @@ -320,6 +330,63 @@ public void setOuterEnum(OuterEnum outerEnum) { this.outerEnum = outerEnum; } + /** + **/ + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("outerEnumInteger") + @Valid public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + @JsonProperty("outerEnumInteger") + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + /** + **/ + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("outerEnumDefaultValue") + @Valid public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + @JsonProperty("outerEnumDefaultValue") + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + /** + **/ + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("outerEnumIntegerDefaultValue") + @Valid public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + @JsonProperty("outerEnumIntegerDefaultValue") + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + @Override public boolean equals(Object o) { @@ -334,12 +401,15 @@ public boolean equals(Object o) { Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && - Objects.equals(this.outerEnum, enumTest.outerEnum); + Objects.equals(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); } @Override public int hashCode() { - return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); } @Override @@ -352,6 +422,9 @@ public String toString() { sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); sb.append("}"); return sb.toString(); } @@ -391,6 +464,9 @@ public static abstract class EnumTestBuilder someMap = new HashMap<>(); + + protected FakeBigDecimalMap200Response(FakeBigDecimalMap200ResponseBuilder b) { + this.someId = b.someId; + this.someMap = b.someMap; + } + + public FakeBigDecimalMap200Response() { + } + + /** + **/ + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("someId") + @Valid public BigDecimal getSomeId() { + return someId; + } + + @JsonProperty("someId") + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + /** + **/ + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("someMap") + @Valid public Map getSomeMap() { + return someMap; + } + + @JsonProperty("someMap") + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + + this.someMap.put(key, someMapItem); + return this; + } + + public FakeBigDecimalMap200Response removeSomeMapItem(String key) { + if (this.someMap != null) { + this.someMap.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FakeBigDecimalMap200ResponseBuilder builder() { + return new FakeBigDecimalMap200ResponseBuilderImpl(); + } + + private static final class FakeBigDecimalMap200ResponseBuilderImpl extends FakeBigDecimalMap200ResponseBuilder { + + @Override + protected FakeBigDecimalMap200ResponseBuilderImpl self() { + return this; + } + + @Override + public FakeBigDecimalMap200Response build() { + return new FakeBigDecimalMap200Response(this); + } + } + + public static abstract class FakeBigDecimalMap200ResponseBuilder> { + private BigDecimal someId; + private Map someMap = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B someId(BigDecimal someId) { + this.someId = someId; + return self(); + } + public B someMap(Map someMap) { + this.someMap = someMap; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Foo.java similarity index 53% rename from samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java rename to samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Foo.java index e0408cdc6440..99b914db2112 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Foo.java @@ -2,9 +2,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.io.Serializable; import javax.validation.constraints.*; import javax.validation.Valid; @@ -18,28 +15,35 @@ -@JsonTypeName("AdditionalPropertiesArray") +@JsonTypeName("Foo") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class AdditionalPropertiesArray extends HashMap implements Serializable { - private String name; +public class Foo implements Serializable { + private String bar = "bar"; + + protected Foo(FooBuilder b) { + this.bar = b.bar; + } + + public Foo() { + } /** **/ - public AdditionalPropertiesArray name(String name) { - this.name = name; + public Foo bar(String bar) { + this.bar = bar; return this; } @ApiModelProperty(value = "") - @JsonProperty("name") - public String getName() { - return name; + @JsonProperty("bar") + public String getBar() { + return bar; } - @JsonProperty("name") - public void setName(String name) { - this.name = name; + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; } @@ -51,22 +55,21 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; - return Objects.equals(this.name, additionalPropertiesArray.name) && - super.equals(o); + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(bar); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesArray {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("class Foo {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); sb.append("}"); return sb.toString(); } @@ -83,5 +86,33 @@ private String toIndentedString(Object o) { } + public static FooBuilder builder() { + return new FooBuilderImpl(); + } + + private static final class FooBuilderImpl extends FooBuilder { + + @Override + protected FooBuilderImpl self() { + return this; + } + + @Override + public Foo build() { + return new Foo(this); + } + } + + public static abstract class FooBuilder> { + private String bar = "bar"; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + } } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..bb6d6c230f81 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java @@ -0,0 +1,120 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Foo; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("_foo_get_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class FooGetDefaultResponse implements Serializable { + private Foo string; + + protected FooGetDefaultResponse(FooGetDefaultResponseBuilder b) { + this.string = b.string; + } + + public FooGetDefaultResponse() { + } + + /** + **/ + public FooGetDefaultResponse string(Foo string) { + this.string = string; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("string") + @Valid public Foo getString() { + return string; + } + + @JsonProperty("string") + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FooGetDefaultResponseBuilder builder() { + return new FooGetDefaultResponseBuilderImpl(); + } + + private static final class FooGetDefaultResponseBuilderImpl extends FooGetDefaultResponseBuilder { + + @Override + protected FooGetDefaultResponseBuilderImpl self() { + return this; + } + + @Override + public FooGetDefaultResponse build() { + return new FooGetDefaultResponse(this); + } + } + + public static abstract class FooGetDefaultResponseBuilder> { + private Foo string; + protected abstract B self(); + + public abstract C build(); + + public B string(Foo string) { + this.string = string; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FormatTest.java index 329a6a4ef27f..779c2a90fe65 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FormatTest.java @@ -31,6 +31,7 @@ public class FormatTest implements Serializable { private BigDecimal number; private Float _float; private Double _double; + private BigDecimal decimal; private String string; private byte[] _byte; private File binary; @@ -38,7 +39,8 @@ public class FormatTest implements Serializable { private Date dateTime; private UUID uuid; private String password; - private BigDecimal bigDecimal; + private String patternWithDigits; + private String patternWithDigitsAndDelimiter; protected FormatTest(FormatTestBuilder b) { this.integer = b.integer; @@ -47,6 +49,7 @@ protected FormatTest(FormatTestBuilder b) { this.number = b.number; this._float = b._float; this._double = b._double; + this.decimal = b.decimal; this.string = b.string; this._byte = b._byte; this.binary = b.binary; @@ -54,7 +57,8 @@ protected FormatTest(FormatTestBuilder b) { this.dateTime = b.dateTime; this.uuid = b.uuid; this.password = b.password; - this.bigDecimal = b.bigDecimal; + this.patternWithDigits = b.patternWithDigits; + this.patternWithDigitsAndDelimiter = b.patternWithDigitsAndDelimiter; } public FormatTest() { @@ -184,6 +188,25 @@ public void setDouble(Double _double) { this._double = _double; } + /** + **/ + public FormatTest decimal(BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("decimal") + @Valid public BigDecimal getDecimal() { + return decimal; + } + + @JsonProperty("decimal") + public void setDecimal(BigDecimal decimal) { + this.decimal = decimal; + } + /** **/ public FormatTest string(String string) { @@ -213,7 +236,7 @@ public FormatTest _byte(byte[] _byte) { @ApiModelProperty(required = true, value = "") @JsonProperty("byte") - @NotNull @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$")public byte[] getByte() { + @NotNull public byte[] getByte() { return _byte; } @@ -318,22 +341,43 @@ public void setPassword(String password) { } /** + * A string that is a 10 digit number. Can have leading zeros. **/ - public FormatTest bigDecimal(BigDecimal bigDecimal) { - this.bigDecimal = bigDecimal; + public FormatTest patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; return this; } - @ApiModelProperty(value = "") - @JsonProperty("BigDecimal") - @Valid public BigDecimal getBigDecimal() { - return bigDecimal; + @ApiModelProperty(value = "A string that is a 10 digit number. Can have leading zeros.") + @JsonProperty("pattern_with_digits") + @Pattern(regexp="^\\d{10}$")public String getPatternWithDigits() { + return patternWithDigits; + } + + @JsonProperty("pattern_with_digits") + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; } - @JsonProperty("BigDecimal") - public void setBigDecimal(BigDecimal bigDecimal) { - this.bigDecimal = bigDecimal; + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + **/ + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + + @ApiModelProperty(value = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @JsonProperty("pattern_with_digits_and_delimiter") + @Pattern(regexp="/^image_\\d{1,3}$/i")public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + @JsonProperty("pattern_with_digits_and_delimiter") + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; } @@ -352,6 +396,7 @@ public boolean equals(Object o) { Objects.equals(this.number, formatTest.number) && Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && + Objects.equals(this.decimal, formatTest.decimal) && Objects.equals(this.string, formatTest.string) && Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && @@ -359,12 +404,13 @@ public boolean equals(Object o) { Objects.equals(this.dateTime, formatTest.dateTime) && Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password) && - Objects.equals(this.bigDecimal, formatTest.bigDecimal); + Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, decimal, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); } @Override @@ -378,6 +424,7 @@ public String toString() { sb.append(" number: ").append(toIndentedString(number)).append("\n"); sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" decimal: ").append(toIndentedString(decimal)).append("\n"); sb.append(" string: ").append(toIndentedString(string)).append("\n"); sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); @@ -385,7 +432,8 @@ public String toString() { sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append("*").append("\n"); - sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); sb.append("}"); return sb.toString(); } @@ -426,6 +474,7 @@ public static abstract class FormatTestBuilder b) { + this.nullableMessage = b.nullableMessage; + } + + public HealthCheckResult() { + } + + /** + **/ + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("NullableMessage") + public String getNullableMessage() { + return nullableMessage; + } + + @JsonProperty("NullableMessage") + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HealthCheckResultBuilder builder() { + return new HealthCheckResultBuilderImpl(); + } + + private static final class HealthCheckResultBuilderImpl extends HealthCheckResultBuilder { + + @Override + protected HealthCheckResultBuilderImpl self() { + return this; + } + + @Override + public HealthCheckResult build() { + return new HealthCheckResult(this); + } + } + + public static abstract class HealthCheckResultBuilder> { + private String nullableMessage; + protected abstract B self(); + + public abstract C build(); + + public B nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MapTest.java index b6e067301bcb..d31817a84d98 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MapTest.java @@ -110,9 +110,9 @@ public MapTest putMapMapOfStringItem(String key, Map mapMapOfStr return this; } - public MapTest removeMapMapOfStringItem(Map mapMapOfStringItem) { - if (mapMapOfStringItem != null && this.mapMapOfString != null) { - this.mapMapOfString.remove(mapMapOfStringItem); + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); } return this; @@ -145,9 +145,9 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) return this; } - public MapTest removeMapOfEnumStringItem(InnerEnum mapOfEnumStringItem) { - if (mapOfEnumStringItem != null && this.mapOfEnumString != null) { - this.mapOfEnumString.remove(mapOfEnumStringItem); + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); } return this; @@ -180,9 +180,9 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { return this; } - public MapTest removeDirectMapItem(Boolean directMapItem) { - if (directMapItem != null && this.directMap != null) { - this.directMap.remove(directMapItem); + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); } return this; @@ -215,9 +215,9 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { return this; } - public MapTest removeIndirectMapItem(Boolean indirectMapItem) { - if (indirectMapItem != null && this.indirectMap != null) { - this.indirectMap.remove(indirectMapItem); + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 807b1886c23a..ac6fe25a039e 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -102,9 +102,9 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal return this; } - public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(Animal mapItem) { - if (mapItem != null && this.map != null) { - this.map.remove(mapItem); + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); } return this; diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/NullableClass.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/NullableClass.java new file mode 100644 index 000000000000..6cd28826c693 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/NullableClass.java @@ -0,0 +1,431 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.joda.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("NullableClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class NullableClass extends HashMap implements Serializable { + private Integer integerProp; + private BigDecimal numberProp; + private Boolean booleanProp; + private String stringProp; + private LocalDate dateProp; + private Date datetimeProp; + private @Valid List arrayNullableProp; + private @Valid List arrayAndItemsNullableProp; + private @Valid List arrayItemsNullable = new ArrayList<>(); + private @Valid Map objectNullableProp; + private @Valid Map objectAndItemsNullableProp; + private @Valid Map objectItemsNullable = new HashMap<>(); + + /** + **/ + public NullableClass integerProp(Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("integer_prop") + public Integer getIntegerProp() { + return integerProp; + } + + @JsonProperty("integer_prop") + public void setIntegerProp(Integer integerProp) { + this.integerProp = integerProp; + } + + /** + **/ + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("number_prop") + @Valid public BigDecimal getNumberProp() { + return numberProp; + } + + @JsonProperty("number_prop") + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + } + + /** + **/ + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("boolean_prop") + public Boolean getBooleanProp() { + return booleanProp; + } + + @JsonProperty("boolean_prop") + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + /** + **/ + public NullableClass stringProp(String stringProp) { + this.stringProp = stringProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("string_prop") + public String getStringProp() { + return stringProp; + } + + @JsonProperty("string_prop") + public void setStringProp(String stringProp) { + this.stringProp = stringProp; + } + + /** + **/ + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("date_prop") + @Valid public LocalDate getDateProp() { + return dateProp; + } + + @JsonProperty("date_prop") + public void setDateProp(LocalDate dateProp) { + this.dateProp = dateProp; + } + + /** + **/ + public NullableClass datetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("datetime_prop") + @Valid public Date getDatetimeProp() { + return datetimeProp; + } + + @JsonProperty("datetime_prop") + public void setDatetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + } + + /** + **/ + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_nullable_prop") + public List getArrayNullableProp() { + return arrayNullableProp; + } + + @JsonProperty("array_nullable_prop") + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + public NullableClass removeArrayNullablePropItem(Object arrayNullablePropItem) { + if (arrayNullablePropItem != null && this.arrayNullableProp != null) { + this.arrayNullableProp.remove(arrayNullablePropItem); + } + + return this; + } + /** + **/ + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_and_items_nullable_prop") + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + @JsonProperty("array_and_items_nullable_prop") + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + public NullableClass removeArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (arrayAndItemsNullablePropItem != null && this.arrayAndItemsNullableProp != null) { + this.arrayAndItemsNullableProp.remove(arrayAndItemsNullablePropItem); + } + + return this; + } + /** + **/ + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_items_nullable") + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + @JsonProperty("array_items_nullable") + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + public NullableClass removeArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (arrayItemsNullableItem != null && this.arrayItemsNullable != null) { + this.arrayItemsNullable.remove(arrayItemsNullableItem); + } + + return this; + } + /** + **/ + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("object_nullable_prop") + public Map getObjectNullableProp() { + return objectNullableProp; + } + + @JsonProperty("object_nullable_prop") + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + public NullableClass removeObjectNullablePropItem(String key) { + if (this.objectNullableProp != null) { + this.objectNullableProp.remove(key); + } + + return this; + } + /** + **/ + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("object_and_items_nullable_prop") + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + @JsonProperty("object_and_items_nullable_prop") + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + public NullableClass removeObjectAndItemsNullablePropItem(String key) { + if (this.objectAndItemsNullableProp != null) { + this.objectAndItemsNullableProp.remove(key); + } + + return this; + } + /** + **/ + public NullableClass objectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("object_items_nullable") + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + @JsonProperty("object_items_nullable") + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + public NullableClass removeObjectItemsNullableItem(String key) { + if (this.objectItemsNullable != null) { + this.objectItemsNullable.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return Objects.equals(this.integerProp, nullableClass.integerProp) && + Objects.equals(this.numberProp, nullableClass.numberProp) && + Objects.equals(this.booleanProp, nullableClass.booleanProp) && + Objects.equals(this.stringProp, nullableClass.stringProp) && + Objects.equals(this.dateProp, nullableClass.dateProp) && + Objects.equals(this.datetimeProp, nullableClass.datetimeProp) && + Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) && + Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) && + Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..2e83493af040 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,223 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.DeprecatedObject; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ObjectWithDeprecatedFields") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class ObjectWithDeprecatedFields implements Serializable { + private String uuid; + private BigDecimal id; + private DeprecatedObject deprecatedRef; + private @Valid List bars = new ArrayList<>(); + + protected ObjectWithDeprecatedFields(ObjectWithDeprecatedFieldsBuilder b) { + this.uuid = b.uuid; + this.id = b.id; + this.deprecatedRef = b.deprecatedRef; + this.bars = b.bars; + } + + public ObjectWithDeprecatedFields() { + } + + /** + **/ + public ObjectWithDeprecatedFields uuid(String uuid) { + this.uuid = uuid; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + **/ + public ObjectWithDeprecatedFields id(BigDecimal id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + @Valid public BigDecimal getId() { + return id; + } + + @JsonProperty("id") + public void setId(BigDecimal id) { + this.id = id; + } + + /** + **/ + public ObjectWithDeprecatedFields deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("deprecatedRef") + @Valid public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + @JsonProperty("deprecatedRef") + public void setDeprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + /** + **/ + public ObjectWithDeprecatedFields bars(List bars) { + this.bars = bars; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("bars") + public List getBars() { + return bars; + } + + @JsonProperty("bars") + public void setBars(List bars) { + this.bars = bars; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + + this.bars.add(barsItem); + return this; + } + + public ObjectWithDeprecatedFields removeBarsItem(String barsItem) { + if (barsItem != null && this.bars != null) { + this.bars.remove(barsItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObjectWithDeprecatedFields objectWithDeprecatedFields = (ObjectWithDeprecatedFields) o; + return Objects.equals(this.uuid, objectWithDeprecatedFields.uuid) && + Objects.equals(this.id, objectWithDeprecatedFields.id) && + Objects.equals(this.deprecatedRef, objectWithDeprecatedFields.deprecatedRef) && + Objects.equals(this.bars, objectWithDeprecatedFields.bars); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, id, deprecatedRef, bars); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ObjectWithDeprecatedFieldsBuilder builder() { + return new ObjectWithDeprecatedFieldsBuilderImpl(); + } + + private static final class ObjectWithDeprecatedFieldsBuilderImpl extends ObjectWithDeprecatedFieldsBuilder { + + @Override + protected ObjectWithDeprecatedFieldsBuilderImpl self() { + return this; + } + + @Override + public ObjectWithDeprecatedFields build() { + return new ObjectWithDeprecatedFields(this); + } + } + + public static abstract class ObjectWithDeprecatedFieldsBuilder> { + private String uuid; + private BigDecimal id; + private DeprecatedObject deprecatedRef; + private List bars = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B uuid(String uuid) { + this.uuid = uuid; + return self(); + } + public B id(BigDecimal id) { + this.id = id; + return self(); + } + public B deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return self(); + } + public B bars(List bars) { + this.bars = bars; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnum.java index a4780a6f6900..5f86922395d7 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnum.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnum.java @@ -36,7 +36,7 @@ public static OuterEnum fromString(String s) { return b; } } - throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + return null; } @Override @@ -52,7 +52,7 @@ public static OuterEnum fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return null; } } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..f9fd44c8deb0 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumDefaultValue fromString(String s) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumInteger.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumInteger.java new file mode 100644 index 000000000000..a81c0a77bebf --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumInteger.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumInteger fromString(String s) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..3f16a4d4e458 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumIntegerDefaultValue fromString(String s) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java new file mode 100644 index 000000000000..96e42d7ac57b --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OuterEnumInteger; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("OuterObjectWithEnumProperty") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class OuterObjectWithEnumProperty implements Serializable { + private OuterEnumInteger value; + + protected OuterObjectWithEnumProperty(OuterObjectWithEnumPropertyBuilder b) { + this.value = b.value; + } + + public OuterObjectWithEnumProperty() { + } + + /** + **/ + public OuterObjectWithEnumProperty value(OuterEnumInteger value) { + this.value = value; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("value") + @NotNull @Valid public OuterEnumInteger getValue() { + return value; + } + + @JsonProperty("value") + public void setValue(OuterEnumInteger value) { + this.value = value; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterObjectWithEnumProperty outerObjectWithEnumProperty = (OuterObjectWithEnumProperty) o; + return Objects.equals(this.value, outerObjectWithEnumProperty.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterObjectWithEnumProperty {\n"); + + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OuterObjectWithEnumPropertyBuilder builder() { + return new OuterObjectWithEnumPropertyBuilderImpl(); + } + + private static final class OuterObjectWithEnumPropertyBuilderImpl extends OuterObjectWithEnumPropertyBuilder { + + @Override + protected OuterObjectWithEnumPropertyBuilderImpl self() { + return this; + } + + @Override + public OuterObjectWithEnumProperty build() { + return new OuterObjectWithEnumProperty(this); + } + } + + public static abstract class OuterObjectWithEnumPropertyBuilder> { + private OuterEnumInteger value; + protected abstract B self(); + + public abstract C build(); + + public B value(OuterEnumInteger value) { + this.value = value; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ParentWithNullable.java new file mode 100644 index 000000000000..5edda7b53e8e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ParentWithNullable.java @@ -0,0 +1,201 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildWithNullable.class, name = "ChildWithNullable"), +}) + + +@JsonTypeName("ParentWithNullable") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") +public class ParentWithNullable implements Serializable { + public enum TypeEnum { + + CHILDWITHNULLABLE(String.valueOf("ChildWithNullable")); + + + private String value; + + TypeEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static TypeEnum fromString(String s) { + for (TypeEnum b : TypeEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private TypeEnum type; + private String nullableProperty; + + protected ParentWithNullable(ParentWithNullableBuilder b) { + this.type = b.type; + this.nullableProperty = b.nullableProperty; + } + + public ParentWithNullable() { + } + + /** + **/ + public ParentWithNullable type(TypeEnum type) { + this.type = type; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("type") + public TypeEnum getType() { + return type; + } + + @JsonProperty("type") + public void setType(TypeEnum type) { + this.type = type; + } + + /** + **/ + public ParentWithNullable nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("nullableProperty") + public String getNullableProperty() { + return nullableProperty; + } + + @JsonProperty("nullableProperty") + public void setNullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParentWithNullable parentWithNullable = (ParentWithNullable) o; + return Objects.equals(this.type, parentWithNullable.type) && + Objects.equals(this.nullableProperty, parentWithNullable.nullableProperty); + } + + @Override + public int hashCode() { + return Objects.hash(type, nullableProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentWithNullable {\n"); + + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ParentWithNullableBuilder builder() { + return new ParentWithNullableBuilderImpl(); + } + + private static final class ParentWithNullableBuilderImpl extends ParentWithNullableBuilder { + + @Override + protected ParentWithNullableBuilderImpl self() { + return this; + } + + @Override + public ParentWithNullable build() { + return new ParentWithNullable(this); + } + } + + public static abstract class ParentWithNullableBuilder> { + private TypeEnum type; + private String nullableProperty; + protected abstract B self(); + + public abstract C build(); + + public B type(TypeEnum type) { + this.type = type; + return self(); + } + public B nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SingleRefType.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SingleRefType.java new file mode 100644 index 000000000000..3314a0f57b45 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SingleRefType.java @@ -0,0 +1,57 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SingleRefType + */ +public enum SingleRefType { + + ADMIN("admin"), + + USER("user"); + + private String value; + + SingleRefType(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static SingleRefType fromString(String s) { + for (SingleRefType b : SingleRefType.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SingleRefType fromValue(String value) { + for (SingleRefType b : SingleRefType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SpecialModelName.java index 88792d979615..a64e1e844fc9 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -16,7 +16,7 @@ -@JsonTypeName("$special[model.name]") +@JsonTypeName("_special_model.name_") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") public class SpecialModelName implements Serializable { private Long $specialPropertyName; @@ -56,8 +56,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SpecialModelName $specialModelName = (SpecialModelName) o; - return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); } @Override diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java similarity index 58% rename from samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java rename to samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java index 1c36e555587c..90f363bc2539 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -1,5 +1,6 @@ package org.openapitools.model; +import com.fasterxml.jackson.annotation.JsonTypeName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; @@ -17,28 +18,28 @@ -@JsonTypeName("AdditionalPropertiesAnyType") +@JsonTypeName("testInlineFreeformAdditionalProperties_request") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class AdditionalPropertiesAnyType extends HashMap implements Serializable { - private String name; +public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap implements Serializable { + private String someProperty; /** **/ - public AdditionalPropertiesAnyType name(String name) { - this.name = name; + public TestInlineFreeformAdditionalPropertiesRequest someProperty(String someProperty) { + this.someProperty = someProperty; return this; } @ApiModelProperty(value = "") - @JsonProperty("name") - public String getName() { - return name; + @JsonProperty("someProperty") + public String getSomeProperty() { + return someProperty; } - @JsonProperty("name") - public void setName(String name) { - this.name = name; + @JsonProperty("someProperty") + public void setSomeProperty(String someProperty) { + this.someProperty = someProperty; } @@ -50,22 +51,22 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; - return Objects.equals(this.name, additionalPropertiesAnyType.name) && + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = (TestInlineFreeformAdditionalPropertiesRequest) o; + return Objects.equals(this.someProperty, testInlineFreeformAdditionalPropertiesRequest.someProperty) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(someProperty, super.hashCode()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesAnyType {\n"); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TypeHolderDefault.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TypeHolderDefault.java deleted file mode 100644 index a92f92dc6353..000000000000 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TypeHolderDefault.java +++ /dev/null @@ -1,250 +0,0 @@ -package org.openapitools.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.io.Serializable; -import javax.validation.constraints.*; -import javax.validation.Valid; - -import io.swagger.annotations.*; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.annotation.JsonTypeName; - - - -@JsonTypeName("TypeHolderDefault") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class TypeHolderDefault implements Serializable { - private String stringItem = "what"; - private BigDecimal numberItem; - private Integer integerItem; - private Boolean boolItem = true; - private @Valid List arrayItem = new ArrayList<>(); - - protected TypeHolderDefault(TypeHolderDefaultBuilder b) { - this.stringItem = b.stringItem; - this.numberItem = b.numberItem; - this.integerItem = b.integerItem; - this.boolItem = b.boolItem; - this.arrayItem = b.arrayItem; - } - - public TypeHolderDefault() { - } - - /** - **/ - public TypeHolderDefault stringItem(String stringItem) { - this.stringItem = stringItem; - return this; - } - - - @ApiModelProperty(required = true, value = "") - @JsonProperty("string_item") - @NotNull public String getStringItem() { - return stringItem; - } - - @JsonProperty("string_item") - public void setStringItem(String stringItem) { - this.stringItem = stringItem; - } - - /** - **/ - public TypeHolderDefault numberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - return this; - } - - - @ApiModelProperty(required = true, value = "") - @JsonProperty("number_item") - @NotNull @Valid public BigDecimal getNumberItem() { - return numberItem; - } - - @JsonProperty("number_item") - public void setNumberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - } - - /** - **/ - public TypeHolderDefault integerItem(Integer integerItem) { - this.integerItem = integerItem; - return this; - } - - - @ApiModelProperty(required = true, value = "") - @JsonProperty("integer_item") - @NotNull public Integer getIntegerItem() { - return integerItem; - } - - @JsonProperty("integer_item") - public void setIntegerItem(Integer integerItem) { - this.integerItem = integerItem; - } - - /** - **/ - public TypeHolderDefault boolItem(Boolean boolItem) { - this.boolItem = boolItem; - return this; - } - - - @ApiModelProperty(required = true, value = "") - @JsonProperty("bool_item") - @NotNull public Boolean getBoolItem() { - return boolItem; - } - - @JsonProperty("bool_item") - public void setBoolItem(Boolean boolItem) { - this.boolItem = boolItem; - } - - /** - **/ - public TypeHolderDefault arrayItem(List arrayItem) { - this.arrayItem = arrayItem; - return this; - } - - - @ApiModelProperty(required = true, value = "") - @JsonProperty("array_item") - @NotNull public List getArrayItem() { - return arrayItem; - } - - @JsonProperty("array_item") - public void setArrayItem(List arrayItem) { - this.arrayItem = arrayItem; - } - - public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { - if (this.arrayItem == null) { - this.arrayItem = new ArrayList<>(); - } - - this.arrayItem.add(arrayItemItem); - return this; - } - - public TypeHolderDefault removeArrayItemItem(Integer arrayItemItem) { - if (arrayItemItem != null && this.arrayItem != null) { - this.arrayItem.remove(arrayItemItem); - } - - return this; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TypeHolderDefault typeHolderDefault = (TypeHolderDefault) o; - return Objects.equals(this.stringItem, typeHolderDefault.stringItem) && - Objects.equals(this.numberItem, typeHolderDefault.numberItem) && - Objects.equals(this.integerItem, typeHolderDefault.integerItem) && - Objects.equals(this.boolItem, typeHolderDefault.boolItem) && - Objects.equals(this.arrayItem, typeHolderDefault.arrayItem); - } - - @Override - public int hashCode() { - return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TypeHolderDefault {\n"); - - sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); - sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); - sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); - sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); - sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static TypeHolderDefaultBuilder builder() { - return new TypeHolderDefaultBuilderImpl(); - } - - private static final class TypeHolderDefaultBuilderImpl extends TypeHolderDefaultBuilder { - - @Override - protected TypeHolderDefaultBuilderImpl self() { - return this; - } - - @Override - public TypeHolderDefault build() { - return new TypeHolderDefault(this); - } - } - - public static abstract class TypeHolderDefaultBuilder> { - private String stringItem = "what"; - private BigDecimal numberItem; - private Integer integerItem; - private Boolean boolItem = true; - private List arrayItem = new ArrayList<>(); - protected abstract B self(); - - public abstract C build(); - - public B stringItem(String stringItem) { - this.stringItem = stringItem; - return self(); - } - public B numberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - return self(); - } - public B integerItem(Integer integerItem) { - this.integerItem = integerItem; - return self(); - } - public B boolItem(Boolean boolItem) { - this.boolItem = boolItem; - return self(); - } - public B arrayItem(List arrayItem) { - this.arrayItem = arrayItem; - return self(); - } - } -} - diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TypeHolderExample.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TypeHolderExample.java deleted file mode 100644 index 2843c906a91b..000000000000 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/TypeHolderExample.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.openapitools.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.io.Serializable; -import javax.validation.constraints.*; -import javax.validation.Valid; - -import io.swagger.annotations.*; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.annotation.JsonTypeName; - - - -@JsonTypeName("TypeHolderExample") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class TypeHolderExample implements Serializable { - private String stringItem; - private BigDecimal numberItem; - private Float floatItem; - private Integer integerItem; - private Boolean boolItem; - private @Valid List arrayItem = new ArrayList<>(); - - protected TypeHolderExample(TypeHolderExampleBuilder b) { - this.stringItem = b.stringItem; - this.numberItem = b.numberItem; - this.floatItem = b.floatItem; - this.integerItem = b.integerItem; - this.boolItem = b.boolItem; - this.arrayItem = b.arrayItem; - } - - public TypeHolderExample() { - } - - /** - **/ - public TypeHolderExample stringItem(String stringItem) { - this.stringItem = stringItem; - return this; - } - - - @ApiModelProperty(example = "what", required = true, value = "") - @JsonProperty("string_item") - @NotNull public String getStringItem() { - return stringItem; - } - - @JsonProperty("string_item") - public void setStringItem(String stringItem) { - this.stringItem = stringItem; - } - - /** - **/ - public TypeHolderExample numberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - return this; - } - - - @ApiModelProperty(example = "1.234", required = true, value = "") - @JsonProperty("number_item") - @NotNull @Valid public BigDecimal getNumberItem() { - return numberItem; - } - - @JsonProperty("number_item") - public void setNumberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - } - - /** - **/ - public TypeHolderExample floatItem(Float floatItem) { - this.floatItem = floatItem; - return this; - } - - - @ApiModelProperty(example = "1.234", required = true, value = "") - @JsonProperty("float_item") - @NotNull public Float getFloatItem() { - return floatItem; - } - - @JsonProperty("float_item") - public void setFloatItem(Float floatItem) { - this.floatItem = floatItem; - } - - /** - **/ - public TypeHolderExample integerItem(Integer integerItem) { - this.integerItem = integerItem; - return this; - } - - - @ApiModelProperty(example = "-2", required = true, value = "") - @JsonProperty("integer_item") - @NotNull public Integer getIntegerItem() { - return integerItem; - } - - @JsonProperty("integer_item") - public void setIntegerItem(Integer integerItem) { - this.integerItem = integerItem; - } - - /** - **/ - public TypeHolderExample boolItem(Boolean boolItem) { - this.boolItem = boolItem; - return this; - } - - - @ApiModelProperty(example = "true", required = true, value = "") - @JsonProperty("bool_item") - @NotNull public Boolean getBoolItem() { - return boolItem; - } - - @JsonProperty("bool_item") - public void setBoolItem(Boolean boolItem) { - this.boolItem = boolItem; - } - - /** - **/ - public TypeHolderExample arrayItem(List arrayItem) { - this.arrayItem = arrayItem; - return this; - } - - - @ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "") - @JsonProperty("array_item") - @NotNull public List getArrayItem() { - return arrayItem; - } - - @JsonProperty("array_item") - public void setArrayItem(List arrayItem) { - this.arrayItem = arrayItem; - } - - public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { - if (this.arrayItem == null) { - this.arrayItem = new ArrayList<>(); - } - - this.arrayItem.add(arrayItemItem); - return this; - } - - public TypeHolderExample removeArrayItemItem(Integer arrayItemItem) { - if (arrayItemItem != null && this.arrayItem != null) { - this.arrayItem.remove(arrayItemItem); - } - - return this; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TypeHolderExample typeHolderExample = (TypeHolderExample) o; - return Objects.equals(this.stringItem, typeHolderExample.stringItem) && - Objects.equals(this.numberItem, typeHolderExample.numberItem) && - Objects.equals(this.floatItem, typeHolderExample.floatItem) && - Objects.equals(this.integerItem, typeHolderExample.integerItem) && - Objects.equals(this.boolItem, typeHolderExample.boolItem) && - Objects.equals(this.arrayItem, typeHolderExample.arrayItem); - } - - @Override - public int hashCode() { - return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TypeHolderExample {\n"); - - sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); - sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); - sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n"); - sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); - sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); - sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static TypeHolderExampleBuilder builder() { - return new TypeHolderExampleBuilderImpl(); - } - - private static final class TypeHolderExampleBuilderImpl extends TypeHolderExampleBuilder { - - @Override - protected TypeHolderExampleBuilderImpl self() { - return this; - } - - @Override - public TypeHolderExample build() { - return new TypeHolderExample(this); - } - } - - public static abstract class TypeHolderExampleBuilder> { - private String stringItem; - private BigDecimal numberItem; - private Float floatItem; - private Integer integerItem; - private Boolean boolItem; - private List arrayItem = new ArrayList<>(); - protected abstract B self(); - - public abstract C build(); - - public B stringItem(String stringItem) { - this.stringItem = stringItem; - return self(); - } - public B numberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - return self(); - } - public B floatItem(Float floatItem) { - this.floatItem = floatItem; - return self(); - } - public B integerItem(Integer integerItem) { - this.integerItem = integerItem; - return self(); - } - public B boolItem(Boolean boolItem) { - this.boolItem = boolItem; - return self(); - } - public B arrayItem(List arrayItem) { - this.arrayItem = arrayItem; - return self(); - } - } -} - diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/XmlItem.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/XmlItem.java deleted file mode 100644 index 712b29ff2d74..000000000000 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/XmlItem.java +++ /dev/null @@ -1,1050 +0,0 @@ -package org.openapitools.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.io.Serializable; -import javax.validation.constraints.*; -import javax.validation.Valid; - -import io.swagger.annotations.*; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.annotation.JsonTypeName; - - - -@JsonTypeName("XmlItem") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class XmlItem implements Serializable { - private String attributeString; - private BigDecimal attributeNumber; - private Integer attributeInteger; - private Boolean attributeBoolean; - private @Valid List wrappedArray = new ArrayList<>(); - private String nameString; - private BigDecimal nameNumber; - private Integer nameInteger; - private Boolean nameBoolean; - private @Valid List nameArray = new ArrayList<>(); - private @Valid List nameWrappedArray = new ArrayList<>(); - private String prefixString; - private BigDecimal prefixNumber; - private Integer prefixInteger; - private Boolean prefixBoolean; - private @Valid List prefixArray = new ArrayList<>(); - private @Valid List prefixWrappedArray = new ArrayList<>(); - private String namespaceString; - private BigDecimal namespaceNumber; - private Integer namespaceInteger; - private Boolean namespaceBoolean; - private @Valid List namespaceArray = new ArrayList<>(); - private @Valid List namespaceWrappedArray = new ArrayList<>(); - private String prefixNsString; - private BigDecimal prefixNsNumber; - private Integer prefixNsInteger; - private Boolean prefixNsBoolean; - private @Valid List prefixNsArray = new ArrayList<>(); - private @Valid List prefixNsWrappedArray = new ArrayList<>(); - - protected XmlItem(XmlItemBuilder b) { - this.attributeString = b.attributeString; - this.attributeNumber = b.attributeNumber; - this.attributeInteger = b.attributeInteger; - this.attributeBoolean = b.attributeBoolean; - this.wrappedArray = b.wrappedArray; - this.nameString = b.nameString; - this.nameNumber = b.nameNumber; - this.nameInteger = b.nameInteger; - this.nameBoolean = b.nameBoolean; - this.nameArray = b.nameArray; - this.nameWrappedArray = b.nameWrappedArray; - this.prefixString = b.prefixString; - this.prefixNumber = b.prefixNumber; - this.prefixInteger = b.prefixInteger; - this.prefixBoolean = b.prefixBoolean; - this.prefixArray = b.prefixArray; - this.prefixWrappedArray = b.prefixWrappedArray; - this.namespaceString = b.namespaceString; - this.namespaceNumber = b.namespaceNumber; - this.namespaceInteger = b.namespaceInteger; - this.namespaceBoolean = b.namespaceBoolean; - this.namespaceArray = b.namespaceArray; - this.namespaceWrappedArray = b.namespaceWrappedArray; - this.prefixNsString = b.prefixNsString; - this.prefixNsNumber = b.prefixNsNumber; - this.prefixNsInteger = b.prefixNsInteger; - this.prefixNsBoolean = b.prefixNsBoolean; - this.prefixNsArray = b.prefixNsArray; - this.prefixNsWrappedArray = b.prefixNsWrappedArray; - } - - public XmlItem() { - } - - /** - **/ - public XmlItem attributeString(String attributeString) { - this.attributeString = attributeString; - return this; - } - - - @ApiModelProperty(example = "string", value = "") - @JsonProperty("attribute_string") - public String getAttributeString() { - return attributeString; - } - - @JsonProperty("attribute_string") - public void setAttributeString(String attributeString) { - this.attributeString = attributeString; - } - - /** - **/ - public XmlItem attributeNumber(BigDecimal attributeNumber) { - this.attributeNumber = attributeNumber; - return this; - } - - - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty("attribute_number") - @Valid public BigDecimal getAttributeNumber() { - return attributeNumber; - } - - @JsonProperty("attribute_number") - public void setAttributeNumber(BigDecimal attributeNumber) { - this.attributeNumber = attributeNumber; - } - - /** - **/ - public XmlItem attributeInteger(Integer attributeInteger) { - this.attributeInteger = attributeInteger; - return this; - } - - - @ApiModelProperty(example = "-2", value = "") - @JsonProperty("attribute_integer") - public Integer getAttributeInteger() { - return attributeInteger; - } - - @JsonProperty("attribute_integer") - public void setAttributeInteger(Integer attributeInteger) { - this.attributeInteger = attributeInteger; - } - - /** - **/ - public XmlItem attributeBoolean(Boolean attributeBoolean) { - this.attributeBoolean = attributeBoolean; - return this; - } - - - @ApiModelProperty(example = "true", value = "") - @JsonProperty("attribute_boolean") - public Boolean getAttributeBoolean() { - return attributeBoolean; - } - - @JsonProperty("attribute_boolean") - public void setAttributeBoolean(Boolean attributeBoolean) { - this.attributeBoolean = attributeBoolean; - } - - /** - **/ - public XmlItem wrappedArray(List wrappedArray) { - this.wrappedArray = wrappedArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("wrapped_array") - public List getWrappedArray() { - return wrappedArray; - } - - @JsonProperty("wrapped_array") - public void setWrappedArray(List wrappedArray) { - this.wrappedArray = wrappedArray; - } - - public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { - if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList<>(); - } - - this.wrappedArray.add(wrappedArrayItem); - return this; - } - - public XmlItem removeWrappedArrayItem(Integer wrappedArrayItem) { - if (wrappedArrayItem != null && this.wrappedArray != null) { - this.wrappedArray.remove(wrappedArrayItem); - } - - return this; - } - /** - **/ - public XmlItem nameString(String nameString) { - this.nameString = nameString; - return this; - } - - - @ApiModelProperty(example = "string", value = "") - @JsonProperty("name_string") - public String getNameString() { - return nameString; - } - - @JsonProperty("name_string") - public void setNameString(String nameString) { - this.nameString = nameString; - } - - /** - **/ - public XmlItem nameNumber(BigDecimal nameNumber) { - this.nameNumber = nameNumber; - return this; - } - - - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty("name_number") - @Valid public BigDecimal getNameNumber() { - return nameNumber; - } - - @JsonProperty("name_number") - public void setNameNumber(BigDecimal nameNumber) { - this.nameNumber = nameNumber; - } - - /** - **/ - public XmlItem nameInteger(Integer nameInteger) { - this.nameInteger = nameInteger; - return this; - } - - - @ApiModelProperty(example = "-2", value = "") - @JsonProperty("name_integer") - public Integer getNameInteger() { - return nameInteger; - } - - @JsonProperty("name_integer") - public void setNameInteger(Integer nameInteger) { - this.nameInteger = nameInteger; - } - - /** - **/ - public XmlItem nameBoolean(Boolean nameBoolean) { - this.nameBoolean = nameBoolean; - return this; - } - - - @ApiModelProperty(example = "true", value = "") - @JsonProperty("name_boolean") - public Boolean getNameBoolean() { - return nameBoolean; - } - - @JsonProperty("name_boolean") - public void setNameBoolean(Boolean nameBoolean) { - this.nameBoolean = nameBoolean; - } - - /** - **/ - public XmlItem nameArray(List nameArray) { - this.nameArray = nameArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("name_array") - public List getNameArray() { - return nameArray; - } - - @JsonProperty("name_array") - public void setNameArray(List nameArray) { - this.nameArray = nameArray; - } - - public XmlItem addNameArrayItem(Integer nameArrayItem) { - if (this.nameArray == null) { - this.nameArray = new ArrayList<>(); - } - - this.nameArray.add(nameArrayItem); - return this; - } - - public XmlItem removeNameArrayItem(Integer nameArrayItem) { - if (nameArrayItem != null && this.nameArray != null) { - this.nameArray.remove(nameArrayItem); - } - - return this; - } - /** - **/ - public XmlItem nameWrappedArray(List nameWrappedArray) { - this.nameWrappedArray = nameWrappedArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("name_wrapped_array") - public List getNameWrappedArray() { - return nameWrappedArray; - } - - @JsonProperty("name_wrapped_array") - public void setNameWrappedArray(List nameWrappedArray) { - this.nameWrappedArray = nameWrappedArray; - } - - public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { - if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList<>(); - } - - this.nameWrappedArray.add(nameWrappedArrayItem); - return this; - } - - public XmlItem removeNameWrappedArrayItem(Integer nameWrappedArrayItem) { - if (nameWrappedArrayItem != null && this.nameWrappedArray != null) { - this.nameWrappedArray.remove(nameWrappedArrayItem); - } - - return this; - } - /** - **/ - public XmlItem prefixString(String prefixString) { - this.prefixString = prefixString; - return this; - } - - - @ApiModelProperty(example = "string", value = "") - @JsonProperty("prefix_string") - public String getPrefixString() { - return prefixString; - } - - @JsonProperty("prefix_string") - public void setPrefixString(String prefixString) { - this.prefixString = prefixString; - } - - /** - **/ - public XmlItem prefixNumber(BigDecimal prefixNumber) { - this.prefixNumber = prefixNumber; - return this; - } - - - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty("prefix_number") - @Valid public BigDecimal getPrefixNumber() { - return prefixNumber; - } - - @JsonProperty("prefix_number") - public void setPrefixNumber(BigDecimal prefixNumber) { - this.prefixNumber = prefixNumber; - } - - /** - **/ - public XmlItem prefixInteger(Integer prefixInteger) { - this.prefixInteger = prefixInteger; - return this; - } - - - @ApiModelProperty(example = "-2", value = "") - @JsonProperty("prefix_integer") - public Integer getPrefixInteger() { - return prefixInteger; - } - - @JsonProperty("prefix_integer") - public void setPrefixInteger(Integer prefixInteger) { - this.prefixInteger = prefixInteger; - } - - /** - **/ - public XmlItem prefixBoolean(Boolean prefixBoolean) { - this.prefixBoolean = prefixBoolean; - return this; - } - - - @ApiModelProperty(example = "true", value = "") - @JsonProperty("prefix_boolean") - public Boolean getPrefixBoolean() { - return prefixBoolean; - } - - @JsonProperty("prefix_boolean") - public void setPrefixBoolean(Boolean prefixBoolean) { - this.prefixBoolean = prefixBoolean; - } - - /** - **/ - public XmlItem prefixArray(List prefixArray) { - this.prefixArray = prefixArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("prefix_array") - public List getPrefixArray() { - return prefixArray; - } - - @JsonProperty("prefix_array") - public void setPrefixArray(List prefixArray) { - this.prefixArray = prefixArray; - } - - public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { - if (this.prefixArray == null) { - this.prefixArray = new ArrayList<>(); - } - - this.prefixArray.add(prefixArrayItem); - return this; - } - - public XmlItem removePrefixArrayItem(Integer prefixArrayItem) { - if (prefixArrayItem != null && this.prefixArray != null) { - this.prefixArray.remove(prefixArrayItem); - } - - return this; - } - /** - **/ - public XmlItem prefixWrappedArray(List prefixWrappedArray) { - this.prefixWrappedArray = prefixWrappedArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("prefix_wrapped_array") - public List getPrefixWrappedArray() { - return prefixWrappedArray; - } - - @JsonProperty("prefix_wrapped_array") - public void setPrefixWrappedArray(List prefixWrappedArray) { - this.prefixWrappedArray = prefixWrappedArray; - } - - public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { - if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList<>(); - } - - this.prefixWrappedArray.add(prefixWrappedArrayItem); - return this; - } - - public XmlItem removePrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { - if (prefixWrappedArrayItem != null && this.prefixWrappedArray != null) { - this.prefixWrappedArray.remove(prefixWrappedArrayItem); - } - - return this; - } - /** - **/ - public XmlItem namespaceString(String namespaceString) { - this.namespaceString = namespaceString; - return this; - } - - - @ApiModelProperty(example = "string", value = "") - @JsonProperty("namespace_string") - public String getNamespaceString() { - return namespaceString; - } - - @JsonProperty("namespace_string") - public void setNamespaceString(String namespaceString) { - this.namespaceString = namespaceString; - } - - /** - **/ - public XmlItem namespaceNumber(BigDecimal namespaceNumber) { - this.namespaceNumber = namespaceNumber; - return this; - } - - - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty("namespace_number") - @Valid public BigDecimal getNamespaceNumber() { - return namespaceNumber; - } - - @JsonProperty("namespace_number") - public void setNamespaceNumber(BigDecimal namespaceNumber) { - this.namespaceNumber = namespaceNumber; - } - - /** - **/ - public XmlItem namespaceInteger(Integer namespaceInteger) { - this.namespaceInteger = namespaceInteger; - return this; - } - - - @ApiModelProperty(example = "-2", value = "") - @JsonProperty("namespace_integer") - public Integer getNamespaceInteger() { - return namespaceInteger; - } - - @JsonProperty("namespace_integer") - public void setNamespaceInteger(Integer namespaceInteger) { - this.namespaceInteger = namespaceInteger; - } - - /** - **/ - public XmlItem namespaceBoolean(Boolean namespaceBoolean) { - this.namespaceBoolean = namespaceBoolean; - return this; - } - - - @ApiModelProperty(example = "true", value = "") - @JsonProperty("namespace_boolean") - public Boolean getNamespaceBoolean() { - return namespaceBoolean; - } - - @JsonProperty("namespace_boolean") - public void setNamespaceBoolean(Boolean namespaceBoolean) { - this.namespaceBoolean = namespaceBoolean; - } - - /** - **/ - public XmlItem namespaceArray(List namespaceArray) { - this.namespaceArray = namespaceArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("namespace_array") - public List getNamespaceArray() { - return namespaceArray; - } - - @JsonProperty("namespace_array") - public void setNamespaceArray(List namespaceArray) { - this.namespaceArray = namespaceArray; - } - - public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { - if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList<>(); - } - - this.namespaceArray.add(namespaceArrayItem); - return this; - } - - public XmlItem removeNamespaceArrayItem(Integer namespaceArrayItem) { - if (namespaceArrayItem != null && this.namespaceArray != null) { - this.namespaceArray.remove(namespaceArrayItem); - } - - return this; - } - /** - **/ - public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { - this.namespaceWrappedArray = namespaceWrappedArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("namespace_wrapped_array") - public List getNamespaceWrappedArray() { - return namespaceWrappedArray; - } - - @JsonProperty("namespace_wrapped_array") - public void setNamespaceWrappedArray(List namespaceWrappedArray) { - this.namespaceWrappedArray = namespaceWrappedArray; - } - - public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { - if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList<>(); - } - - this.namespaceWrappedArray.add(namespaceWrappedArrayItem); - return this; - } - - public XmlItem removeNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { - if (namespaceWrappedArrayItem != null && this.namespaceWrappedArray != null) { - this.namespaceWrappedArray.remove(namespaceWrappedArrayItem); - } - - return this; - } - /** - **/ - public XmlItem prefixNsString(String prefixNsString) { - this.prefixNsString = prefixNsString; - return this; - } - - - @ApiModelProperty(example = "string", value = "") - @JsonProperty("prefix_ns_string") - public String getPrefixNsString() { - return prefixNsString; - } - - @JsonProperty("prefix_ns_string") - public void setPrefixNsString(String prefixNsString) { - this.prefixNsString = prefixNsString; - } - - /** - **/ - public XmlItem prefixNsNumber(BigDecimal prefixNsNumber) { - this.prefixNsNumber = prefixNsNumber; - return this; - } - - - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty("prefix_ns_number") - @Valid public BigDecimal getPrefixNsNumber() { - return prefixNsNumber; - } - - @JsonProperty("prefix_ns_number") - public void setPrefixNsNumber(BigDecimal prefixNsNumber) { - this.prefixNsNumber = prefixNsNumber; - } - - /** - **/ - public XmlItem prefixNsInteger(Integer prefixNsInteger) { - this.prefixNsInteger = prefixNsInteger; - return this; - } - - - @ApiModelProperty(example = "-2", value = "") - @JsonProperty("prefix_ns_integer") - public Integer getPrefixNsInteger() { - return prefixNsInteger; - } - - @JsonProperty("prefix_ns_integer") - public void setPrefixNsInteger(Integer prefixNsInteger) { - this.prefixNsInteger = prefixNsInteger; - } - - /** - **/ - public XmlItem prefixNsBoolean(Boolean prefixNsBoolean) { - this.prefixNsBoolean = prefixNsBoolean; - return this; - } - - - @ApiModelProperty(example = "true", value = "") - @JsonProperty("prefix_ns_boolean") - public Boolean getPrefixNsBoolean() { - return prefixNsBoolean; - } - - @JsonProperty("prefix_ns_boolean") - public void setPrefixNsBoolean(Boolean prefixNsBoolean) { - this.prefixNsBoolean = prefixNsBoolean; - } - - /** - **/ - public XmlItem prefixNsArray(List prefixNsArray) { - this.prefixNsArray = prefixNsArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("prefix_ns_array") - public List getPrefixNsArray() { - return prefixNsArray; - } - - @JsonProperty("prefix_ns_array") - public void setPrefixNsArray(List prefixNsArray) { - this.prefixNsArray = prefixNsArray; - } - - public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { - if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList<>(); - } - - this.prefixNsArray.add(prefixNsArrayItem); - return this; - } - - public XmlItem removePrefixNsArrayItem(Integer prefixNsArrayItem) { - if (prefixNsArrayItem != null && this.prefixNsArray != null) { - this.prefixNsArray.remove(prefixNsArrayItem); - } - - return this; - } - /** - **/ - public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { - this.prefixNsWrappedArray = prefixNsWrappedArray; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("prefix_ns_wrapped_array") - public List getPrefixNsWrappedArray() { - return prefixNsWrappedArray; - } - - @JsonProperty("prefix_ns_wrapped_array") - public void setPrefixNsWrappedArray(List prefixNsWrappedArray) { - this.prefixNsWrappedArray = prefixNsWrappedArray; - } - - public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { - if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList<>(); - } - - this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); - return this; - } - - public XmlItem removePrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { - if (prefixNsWrappedArrayItem != null && this.prefixNsWrappedArray != null) { - this.prefixNsWrappedArray.remove(prefixNsWrappedArrayItem); - } - - return this; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - XmlItem xmlItem = (XmlItem) o; - return Objects.equals(this.attributeString, xmlItem.attributeString) && - Objects.equals(this.attributeNumber, xmlItem.attributeNumber) && - Objects.equals(this.attributeInteger, xmlItem.attributeInteger) && - Objects.equals(this.attributeBoolean, xmlItem.attributeBoolean) && - Objects.equals(this.wrappedArray, xmlItem.wrappedArray) && - Objects.equals(this.nameString, xmlItem.nameString) && - Objects.equals(this.nameNumber, xmlItem.nameNumber) && - Objects.equals(this.nameInteger, xmlItem.nameInteger) && - Objects.equals(this.nameBoolean, xmlItem.nameBoolean) && - Objects.equals(this.nameArray, xmlItem.nameArray) && - Objects.equals(this.nameWrappedArray, xmlItem.nameWrappedArray) && - Objects.equals(this.prefixString, xmlItem.prefixString) && - Objects.equals(this.prefixNumber, xmlItem.prefixNumber) && - Objects.equals(this.prefixInteger, xmlItem.prefixInteger) && - Objects.equals(this.prefixBoolean, xmlItem.prefixBoolean) && - Objects.equals(this.prefixArray, xmlItem.prefixArray) && - Objects.equals(this.prefixWrappedArray, xmlItem.prefixWrappedArray) && - Objects.equals(this.namespaceString, xmlItem.namespaceString) && - Objects.equals(this.namespaceNumber, xmlItem.namespaceNumber) && - Objects.equals(this.namespaceInteger, xmlItem.namespaceInteger) && - Objects.equals(this.namespaceBoolean, xmlItem.namespaceBoolean) && - Objects.equals(this.namespaceArray, xmlItem.namespaceArray) && - Objects.equals(this.namespaceWrappedArray, xmlItem.namespaceWrappedArray) && - Objects.equals(this.prefixNsString, xmlItem.prefixNsString) && - Objects.equals(this.prefixNsNumber, xmlItem.prefixNsNumber) && - Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && - Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && - Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && - Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray); - } - - @Override - public int hashCode() { - return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class XmlItem {\n"); - - sb.append(" attributeString: ").append(toIndentedString(attributeString)).append("\n"); - sb.append(" attributeNumber: ").append(toIndentedString(attributeNumber)).append("\n"); - sb.append(" attributeInteger: ").append(toIndentedString(attributeInteger)).append("\n"); - sb.append(" attributeBoolean: ").append(toIndentedString(attributeBoolean)).append("\n"); - sb.append(" wrappedArray: ").append(toIndentedString(wrappedArray)).append("\n"); - sb.append(" nameString: ").append(toIndentedString(nameString)).append("\n"); - sb.append(" nameNumber: ").append(toIndentedString(nameNumber)).append("\n"); - sb.append(" nameInteger: ").append(toIndentedString(nameInteger)).append("\n"); - sb.append(" nameBoolean: ").append(toIndentedString(nameBoolean)).append("\n"); - sb.append(" nameArray: ").append(toIndentedString(nameArray)).append("\n"); - sb.append(" nameWrappedArray: ").append(toIndentedString(nameWrappedArray)).append("\n"); - sb.append(" prefixString: ").append(toIndentedString(prefixString)).append("\n"); - sb.append(" prefixNumber: ").append(toIndentedString(prefixNumber)).append("\n"); - sb.append(" prefixInteger: ").append(toIndentedString(prefixInteger)).append("\n"); - sb.append(" prefixBoolean: ").append(toIndentedString(prefixBoolean)).append("\n"); - sb.append(" prefixArray: ").append(toIndentedString(prefixArray)).append("\n"); - sb.append(" prefixWrappedArray: ").append(toIndentedString(prefixWrappedArray)).append("\n"); - sb.append(" namespaceString: ").append(toIndentedString(namespaceString)).append("\n"); - sb.append(" namespaceNumber: ").append(toIndentedString(namespaceNumber)).append("\n"); - sb.append(" namespaceInteger: ").append(toIndentedString(namespaceInteger)).append("\n"); - sb.append(" namespaceBoolean: ").append(toIndentedString(namespaceBoolean)).append("\n"); - sb.append(" namespaceArray: ").append(toIndentedString(namespaceArray)).append("\n"); - sb.append(" namespaceWrappedArray: ").append(toIndentedString(namespaceWrappedArray)).append("\n"); - sb.append(" prefixNsString: ").append(toIndentedString(prefixNsString)).append("\n"); - sb.append(" prefixNsNumber: ").append(toIndentedString(prefixNsNumber)).append("\n"); - sb.append(" prefixNsInteger: ").append(toIndentedString(prefixNsInteger)).append("\n"); - sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); - sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); - sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static XmlItemBuilder builder() { - return new XmlItemBuilderImpl(); - } - - private static final class XmlItemBuilderImpl extends XmlItemBuilder { - - @Override - protected XmlItemBuilderImpl self() { - return this; - } - - @Override - public XmlItem build() { - return new XmlItem(this); - } - } - - public static abstract class XmlItemBuilder> { - private String attributeString; - private BigDecimal attributeNumber; - private Integer attributeInteger; - private Boolean attributeBoolean; - private List wrappedArray = new ArrayList<>(); - private String nameString; - private BigDecimal nameNumber; - private Integer nameInteger; - private Boolean nameBoolean; - private List nameArray = new ArrayList<>(); - private List nameWrappedArray = new ArrayList<>(); - private String prefixString; - private BigDecimal prefixNumber; - private Integer prefixInteger; - private Boolean prefixBoolean; - private List prefixArray = new ArrayList<>(); - private List prefixWrappedArray = new ArrayList<>(); - private String namespaceString; - private BigDecimal namespaceNumber; - private Integer namespaceInteger; - private Boolean namespaceBoolean; - private List namespaceArray = new ArrayList<>(); - private List namespaceWrappedArray = new ArrayList<>(); - private String prefixNsString; - private BigDecimal prefixNsNumber; - private Integer prefixNsInteger; - private Boolean prefixNsBoolean; - private List prefixNsArray = new ArrayList<>(); - private List prefixNsWrappedArray = new ArrayList<>(); - protected abstract B self(); - - public abstract C build(); - - public B attributeString(String attributeString) { - this.attributeString = attributeString; - return self(); - } - public B attributeNumber(BigDecimal attributeNumber) { - this.attributeNumber = attributeNumber; - return self(); - } - public B attributeInteger(Integer attributeInteger) { - this.attributeInteger = attributeInteger; - return self(); - } - public B attributeBoolean(Boolean attributeBoolean) { - this.attributeBoolean = attributeBoolean; - return self(); - } - public B wrappedArray(List wrappedArray) { - this.wrappedArray = wrappedArray; - return self(); - } - public B nameString(String nameString) { - this.nameString = nameString; - return self(); - } - public B nameNumber(BigDecimal nameNumber) { - this.nameNumber = nameNumber; - return self(); - } - public B nameInteger(Integer nameInteger) { - this.nameInteger = nameInteger; - return self(); - } - public B nameBoolean(Boolean nameBoolean) { - this.nameBoolean = nameBoolean; - return self(); - } - public B nameArray(List nameArray) { - this.nameArray = nameArray; - return self(); - } - public B nameWrappedArray(List nameWrappedArray) { - this.nameWrappedArray = nameWrappedArray; - return self(); - } - public B prefixString(String prefixString) { - this.prefixString = prefixString; - return self(); - } - public B prefixNumber(BigDecimal prefixNumber) { - this.prefixNumber = prefixNumber; - return self(); - } - public B prefixInteger(Integer prefixInteger) { - this.prefixInteger = prefixInteger; - return self(); - } - public B prefixBoolean(Boolean prefixBoolean) { - this.prefixBoolean = prefixBoolean; - return self(); - } - public B prefixArray(List prefixArray) { - this.prefixArray = prefixArray; - return self(); - } - public B prefixWrappedArray(List prefixWrappedArray) { - this.prefixWrappedArray = prefixWrappedArray; - return self(); - } - public B namespaceString(String namespaceString) { - this.namespaceString = namespaceString; - return self(); - } - public B namespaceNumber(BigDecimal namespaceNumber) { - this.namespaceNumber = namespaceNumber; - return self(); - } - public B namespaceInteger(Integer namespaceInteger) { - this.namespaceInteger = namespaceInteger; - return self(); - } - public B namespaceBoolean(Boolean namespaceBoolean) { - this.namespaceBoolean = namespaceBoolean; - return self(); - } - public B namespaceArray(List namespaceArray) { - this.namespaceArray = namespaceArray; - return self(); - } - public B namespaceWrappedArray(List namespaceWrappedArray) { - this.namespaceWrappedArray = namespaceWrappedArray; - return self(); - } - public B prefixNsString(String prefixNsString) { - this.prefixNsString = prefixNsString; - return self(); - } - public B prefixNsNumber(BigDecimal prefixNsNumber) { - this.prefixNsNumber = prefixNsNumber; - return self(); - } - public B prefixNsInteger(Integer prefixNsInteger) { - this.prefixNsInteger = prefixNsInteger; - return self(); - } - public B prefixNsBoolean(Boolean prefixNsBoolean) { - this.prefixNsBoolean = prefixNsBoolean; - return self(); - } - public B prefixNsArray(List prefixNsArray) { - this.prefixNsArray = prefixNsArray; - return self(); - } - public B prefixNsWrappedArray(List prefixNsWrappedArray) { - this.prefixNsWrappedArray = prefixNsWrappedArray; - return self(); - } - } -} - diff --git a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml index 6415519aac29..d456aa0a571c 100644 --- a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +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:\ @@ -9,7 +9,30 @@ info: title: OpenAPI Petstore version: 1.0.0 servers: -- url: http://petstore.swagger.io:80/v2 +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_varaible tags: - description: Everything about your Pets name: pet @@ -18,25 +41,27 @@ tags: - description: Operations about user name: user paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/_foo_get_default_response' + description: response + x-accepts: + - application/json /pet: post: + description: "" operationId: addPet requestBody: - 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 + $ref: '#/components/requestBodies/Pet' responses: "200": - content: {} - description: successful operation + description: Successful operation "405": - content: {} description: Invalid input security: - petstore_auth: @@ -45,36 +70,24 @@ paths: summary: Add a new pet to the store tags: - pet - x-codegen-request-body-name: body x-content-type: application/json x-accepts: - application/json x-tags: - tag: pet put: + description: "" operationId: updatePet requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true + $ref: '#/components/requestBodies/Pet' responses: "200": - content: {} - description: successful operation + description: Successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Pet not found "405": - content: {} description: Validation exception security: - petstore_auth: @@ -83,18 +96,37 @@ paths: summary: Update an existing pet tags: - pet - x-codegen-request-body-name: body + x-webclient-blocking: true x-content-type: application/json x-accepts: - application/json x-tags: - tag: pet + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + - description: test server with variables + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + description: target server + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" /pet/findByStatus: get: description: Multiple status values can be provided with comma separated strings operationId: findPetsByStatus parameters: - - description: Status values that need to be considered for filter + - deprecated: true + description: Status values that need to be considered for filter explode: false in: query name: status @@ -124,7 +156,6 @@ paths: type: array description: successful operation "400": - content: {} description: Invalid status value security: - petstore_auth: @@ -133,6 +164,7 @@ paths: summary: Finds Pets by status tags: - pet + x-webclient-blocking: true x-accepts: - application/json - application/xml @@ -173,7 +205,6 @@ paths: uniqueItems: true description: successful operation "400": - content: {} description: Invalid tag value security: - petstore_auth: @@ -182,6 +213,7 @@ paths: summary: Finds Pets by tags tags: - pet + x-webclient-blocking: true x-accepts: - application/json - application/xml @@ -189,25 +221,29 @@ paths: - tag: pet /pet/{petId}: delete: + description: "" operationId: deletePet parameters: - - in: header + - explode: false + in: header name: api_key + required: false schema: type: string + style: simple - description: Pet id to delete + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple responses: "200": - content: {} - description: successful operation + description: Successful operation "400": - content: {} description: Invalid pet value security: - petstore_auth: @@ -225,12 +261,14 @@ paths: operationId: getPetById parameters: - description: ID of pet to return + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple responses: "200": content: @@ -242,39 +280,42 @@ paths: $ref: '#/components/schemas/Pet' description: successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Pet not found security: - api_key: [] summary: Find pet by ID tags: - pet + x-webclient-blocking: true x-accepts: - application/json - application/xml x-tags: - tag: pet post: + description: "" operationId: updatePetWithForm parameters: - description: ID of pet that needs to be updated + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/updatePetWithForm_request' responses: + "200": + description: Successful operation "405": - content: {} description: Invalid input security: - petstore_auth: @@ -290,15 +331,18 @@ paths: - tag: pet /pet/{petId}/uploadImage: post: + description: "" operationId: uploadFile parameters: - description: ID of pet to update + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: content: multipart/form-data: @@ -342,16 +386,18 @@ paths: summary: Returns pet inventories by status tags: - store + x-webclient-blocking: false x-accepts: - application/json x-tags: - tag: store /store/order: post: + description: "" operationId: placeOrder requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/Order' description: order placed for purchasing the pet @@ -367,13 +413,11 @@ paths: $ref: '#/components/schemas/Order' description: successful operation "400": - content: {} description: Invalid Order summary: Place an order for a pet tags: - store - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json x-accepts: - application/json - application/xml @@ -386,17 +430,17 @@ paths: operationId: deleteOrder parameters: - description: ID of the order that needs to be deleted + explode: false in: path name: order_id required: true schema: type: string + style: simple responses: "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Order not found summary: Delete purchase order by ID tags: @@ -411,6 +455,7 @@ paths: operationId: getOrderById parameters: - description: ID of pet that needs to be fetched + explode: false in: path name: order_id required: true @@ -419,6 +464,7 @@ paths: maximum: 5 minimum: 1 type: integer + style: simple responses: "200": content: @@ -430,10 +476,8 @@ paths: $ref: '#/components/schemas/Order' description: successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Order not found summary: Find purchase order by ID tags: @@ -449,90 +493,77 @@ paths: operationId: createUser requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' description: Created user object required: true responses: default: - content: {} description: successful operation summary: Create user tags: - user - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json x-accepts: - application/json x-tags: - tag: user /user/createWithArray: post: + description: "" operationId: createUsersWithArrayInput requestBody: - content: - '*/*': - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: - content: {} description: successful operation summary: Creates list of users with given input array tags: - user - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json x-accepts: - application/json x-tags: - tag: user /user/createWithList: post: + description: "" operationId: createUsersWithListInput requestBody: - content: - '*/*': - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: - content: {} description: successful operation summary: Creates list of users with given input array tags: - user - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json x-accepts: - application/json x-tags: - tag: user /user/login: get: + description: "" operationId: loginUser parameters: - description: The user name for login + explode: true in: query name: username required: true schema: type: string + style: form - description: The password for login in clear text + explode: true in: query name: password required: true schema: type: string + style: form responses: "200": content: @@ -546,16 +577,19 @@ paths: headers: X-Rate-Limit: description: calls per hour allowed by the user + explode: false schema: format: int32 type: integer + style: simple X-Expires-After: description: date in UTC when token expires + explode: false schema: format: date-time type: string + style: simple "400": - content: {} description: Invalid username/password supplied summary: Logs user into the system tags: @@ -567,10 +601,10 @@ paths: - tag: user /user/logout: get: + description: "" operationId: logoutUser responses: default: - content: {} description: successful operation summary: Logs out current logged in user session tags: @@ -585,17 +619,17 @@ paths: operationId: deleteUser parameters: - description: The name that needs to be deleted + explode: false in: path name: username required: true schema: type: string + style: simple responses: "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found summary: Delete user tags: @@ -605,14 +639,17 @@ paths: x-tags: - tag: user get: + description: "" operationId: getUserByName parameters: - description: The name that needs to be fetched. Use user1 for testing. + explode: false in: path name: username required: true schema: type: string + style: simple responses: "200": content: @@ -624,10 +661,8 @@ paths: $ref: '#/components/schemas/User' description: successful operation "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found summary: Get user by user name tags: @@ -642,30 +677,29 @@ paths: operationId: updateUser parameters: - description: name that need to be deleted + explode: false in: path name: username required: true schema: type: string + style: simple requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' description: Updated user object required: true responses: "400": - content: {} description: Invalid user supplied "404": - content: {} description: User not found summary: Updated user tags: - user - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json x-accepts: - application/json x-tags: @@ -675,12 +709,7 @@ paths: description: To test class name in snake case operationId: testClassname requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - required: true + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -693,7 +722,6 @@ paths: summary: To test class name in snake case tags: - fake_classname_tags 123#$%^ - x-codegen-request-body-name: body x-content-type: application/json x-accepts: - application/json @@ -705,44 +733,60 @@ paths: operationId: testGroupParameters parameters: - description: Required String in group parameters + explode: true in: query name: required_string_group required: true schema: type: integer + style: form - description: Required Boolean in group parameters + explode: false in: header name: required_boolean_group required: true schema: type: boolean + style: simple - description: Required Integer in group parameters + explode: true in: query name: required_int64_group required: true schema: format: int64 type: integer + style: form - description: String in group parameters + explode: true in: query name: string_group + required: false schema: type: integer + style: form - description: Boolean in group parameters + explode: false in: header name: boolean_group + required: false schema: type: boolean + style: simple - description: Integer in group parameters + explode: true in: query name: int64_group + required: false schema: format: int64 type: integer + style: form responses: "400": - content: {} description: Something wrong + security: + - bearer_test: [] summary: Fake endpoint to test group parameters (optional) tags: - fake @@ -759,6 +803,7 @@ paths: explode: false in: header name: enum_header_string_array + required: false schema: items: default: $ @@ -769,8 +814,10 @@ paths: type: array style: simple - description: Header parameter enum test (string) + explode: false in: header name: enum_header_string + required: false schema: default: -efg enum: @@ -778,10 +825,12 @@ paths: - -efg - (xyz) type: string + style: simple - description: Query parameter enum test (string array) - explode: false + explode: true in: query name: enum_query_string_array + required: false schema: items: default: $ @@ -792,8 +841,10 @@ paths: type: array style: form - description: Query parameter enum test (string) + explode: true in: query name: enum_query_string + required: false schema: default: -efg enum: @@ -801,24 +852,40 @@ paths: - -efg - (xyz) type: string + style: form - description: Query parameter enum test (double) + explode: true in: query name: enum_query_integer + required: false schema: enum: - 1 - -2 format: int32 type: integer + style: form - description: Query parameter enum test (double) + explode: true in: query name: enum_query_double + required: false schema: enum: - 1.1 - -1.2 format: double type: number + style: form + - explode: true + in: query + name: enum_query_model_array + required: false + schema: + items: + $ref: '#/components/schemas/EnumClass' + type: array + style: form requestBody: content: application/x-www-form-urlencoded: @@ -826,10 +893,8 @@ paths: $ref: '#/components/schemas/testEnumParameters_request' responses: "400": - content: {} description: Invalid request "404": - content: {} description: Not found summary: To test enum parameters tags: @@ -843,12 +908,7 @@ paths: description: To test "client" model operationId: testClientModel requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - required: true + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -859,39 +919,35 @@ paths: summary: To test "client" model tags: - fake - x-codegen-request-body-name: body x-content-type: application/json x-accepts: - application/json x-tags: - tag: fake post: - description: |- + description: | Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 operationId: testEndpointParameters requestBody: content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/testEndpointParameters_request' - required: true responses: "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found security: - http_basic_test: [] - summary: |- + summary: | Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 tags: - fake x-content-type: application/x-www-form-urlencoded @@ -905,11 +961,10 @@ paths: operationId: fakeOuterNumberSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterNumber' description: Input number as post body - required: false responses: "200": content: @@ -919,8 +974,32 @@ paths: description: Output number tags: - fake - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/property/enum-int: + post: + description: Test serialization of enum (int) properties with examples + operationId: fakePropertyEnumIntegerSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterObjectWithEnumProperty' + description: Input enum (int) as post body + required: true + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterObjectWithEnumProperty' + description: Output enum (int) + tags: + - fake + x-content-type: application/json x-accepts: - '*/*' x-tags: @@ -931,11 +1010,10 @@ paths: operationId: fakeOuterStringSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterString' description: Input string as post body - required: false responses: "200": content: @@ -945,8 +1023,7 @@ paths: description: Output string tags: - fake - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json x-accepts: - '*/*' x-tags: @@ -957,11 +1034,10 @@ paths: operationId: fakeOuterBooleanSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterBoolean' description: Input boolean as post body - required: false responses: "200": content: @@ -971,8 +1047,7 @@ paths: description: Output boolean tags: - fake - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json x-accepts: - '*/*' x-tags: @@ -983,11 +1058,10 @@ paths: operationId: fakeOuterCompositeSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterComposite' description: Input composite as post body - required: false responses: "200": content: @@ -997,24 +1071,40 @@ paths: description: Output composite tags: - fake - x-codegen-request-body-name: body - x-content-type: '*/*' + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake x-accepts: - '*/*' x-tags: - tag: fake /fake/jsonFormData: get: + description: "" operationId: testJsonFormData requestBody: content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/testJsonFormData_request' - required: true responses: "200": - content: {} description: successful operation summary: test json serialization of form data tags: @@ -1024,8 +1114,53 @@ paths: - application/json x-tags: - tag: fake + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MapOfString' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake /fake/inline-additionalProperties: post: + description: "" operationId: testInlineAdditionalProperties requestBody: content: @@ -1038,102 +1173,92 @@ paths: required: true responses: "200": - content: {} description: successful operation summary: test inline additionalProperties tags: - fake - x-codegen-request-body-name: param x-content-type: application/json x-accepts: - application/json x-tags: - tag: fake - /fake/body-with-query-params: - put: - operationId: testBodyWithQueryParams - parameters: - - in: query - name: query - required: true - schema: - type: string + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties requestBody: content: application/json: schema: - $ref: '#/components/schemas/User' + $ref: '#/components/schemas/testInlineFreeformAdditionalProperties_request' + description: request body required: true responses: "200": - content: {} - description: Success + description: successful operation + summary: test inline free-form additionalProperties tags: - fake - x-codegen-request-body-name: body x-content-type: application/json x-accepts: - application/json x-tags: - tag: fake - /fake/create_xml_item: + /fake/nullable: post: - description: this route creates an XmlItem - operationId: createXmlItem + description: "" + operationId: testNullable requestBody: content: - application/xml: - schema: - $ref: '#/components/schemas/XmlItem' - application/xml; charset=utf-8: - schema: - $ref: '#/components/schemas/XmlItem' - application/xml; charset=utf-16: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml; charset=utf-8: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml; charset=utf-16: + application/json: schema: - $ref: '#/components/schemas/XmlItem' - description: XmlItem Body + $ref: '#/components/schemas/ChildWithNullable' + description: request body required: true responses: "200": - content: {} description: successful operation - summary: creates an XmlItem + summary: test nullable parent property tags: - fake - x-codegen-request-body-name: XmlItem - x-content-type: application/xml + x-content-type: application/json x-accepts: - application/json x-tags: - tag: fake - /another-fake/dummy: - patch: - description: To test special tags and operation ID starting with number - operationId: 123_test_@#$%_special_tags + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams parameters: - - description: to test uuid example value - in: header - name: uuid_test + - explode: true + in: query + name: query required: true schema: - format: uuid type: string + style: form requestBody: content: application/json: schema: - $ref: '#/components/schemas/Client' - description: client model + $ref: '#/components/schemas/User' required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -1144,7 +1269,6 @@ paths: summary: To test special tags tags: - $another-fake? - x-codegen-request-body-name: body x-content-type: application/json x-accepts: - application/json @@ -1152,7 +1276,7 @@ paths: - tag: $another-fake? /fake/body-with-file-schema: put: - description: "For this test, the body for this request much reference a schema\ + description: "For this test, the body for this request must reference a schema\ \ named `File`." operationId: testBodyWithFileSchema requestBody: @@ -1163,16 +1287,37 @@ paths: required: true responses: "200": - content: {} description: Success tags: - fake - x-codegen-request-body-name: body x-content-type: application/json x-accepts: - application/json x-tags: - tag: fake + /fake/body-with-binary: + put: + description: "For this test, the body has to be a binary file." + operationId: testBodyWithBinary + requestBody: + content: + image/png: + schema: + format: binary + nullable: true + type: string + description: image to upload + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: image/png + x-accepts: + - application/json + x-tags: + - tag: fake /fake/test-query-parameters: put: description: To test the collection format in query parameters @@ -1186,15 +1331,18 @@ paths: items: type: string type: array - style: form - - in: query + style: pipeDelimited + - explode: false + in: query name: ioutil required: true schema: items: type: string type: array - - in: query + style: form + - explode: false + in: query name: http required: true schema: @@ -1220,9 +1368,26 @@ paths: type: string type: array style: form + - explode: true + in: query + name: language + required: false + schema: + additionalProperties: + format: string + type: string + type: object + style: form + - allowEmptyValue: true + explode: true + in: query + name: allowEmpty + required: true + schema: + type: string + style: form responses: "200": - content: {} description: Success tags: - fake @@ -1232,21 +1397,23 @@ paths: - tag: fake /fake/{petId}/uploadImageWithRequiredFile: post: + description: "" operationId: uploadFileWithRequiredFile parameters: - description: ID of pet to update + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: content: multipart/form-data: schema: $ref: '#/components/schemas/uploadFileWithRequiredFile_request' - required: true responses: "200": content: @@ -1266,8 +1433,97 @@ paths: - application/json x-tags: - tag: pet + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/http-signature-test: + get: + operationId: fake-http-signature-test + parameters: + - description: query parameter + explode: true + in: query + name: query_1 + required: false + schema: + type: string + style: form + - description: header parameter + explode: false + in: header + name: header_1 + required: false + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + description: The instance started successfully + security: + - http_signature_test: [] + summary: test http signature authentication + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string Order: example: petId: 6 @@ -1433,21 +1689,12 @@ components: message: type: string type: object - $special[model.name]: - properties: - $special[property.name]: - format: int64 - type: integer - type: object - xml: - name: "$special[model.name]" Return: description: Model for testing reserved words properties: return: format: int32 type: integer - type: object xml: name: Return Name: @@ -1467,7 +1714,6 @@ components: type: integer required: - name - type: object xml: name: Name "200_response": @@ -1478,7 +1724,6 @@ components: type: integer class: type: string - type: object xml: name: Name ClassModel: @@ -1486,7 +1731,6 @@ components: properties: _class: type: string - type: object Dog: allOf: - $ref: '#/components/schemas/Animal' @@ -1501,20 +1745,11 @@ components: declawed: type: boolean type: object - BigCat: - allOf: - - $ref: '#/components/schemas/Cat' - - properties: - kind: - enum: - - lions - - tigers - - leopards - - jaguars - type: string - type: object Animal: discriminator: + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' propertyName: className properties: className: @@ -1557,12 +1792,14 @@ components: maximum: 123.4 minimum: 67.8 type: number + decimal: + format: number + type: string string: pattern: "/[a-z]/i" type: string byte: format: byte - pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" type: string binary: format: binary @@ -1582,8 +1819,14 @@ components: maxLength: 64 minLength: 10 type: string - BigDecimal: - format: number + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" type: string required: - byte @@ -1626,117 +1869,27 @@ components: type: number outerEnum: $ref: '#/components/schemas/OuterEnum' + outerEnumInteger: + $ref: '#/components/schemas/OuterEnumInteger' + outerEnumDefaultValue: + $ref: '#/components/schemas/OuterEnumDefaultValue' + outerEnumIntegerDefaultValue: + $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' required: - enum_string_required type: object AdditionalPropertiesClass: properties: - map_string: + map_property: additionalProperties: type: string type: object - map_number: - additionalProperties: - type: number - type: object - map_integer: - additionalProperties: - type: integer - type: object - map_boolean: - additionalProperties: - type: boolean - type: object - map_array_integer: - additionalProperties: - items: - type: integer - type: array - type: object - map_array_anytype: - additionalProperties: - items: - properties: {} - type: object - type: array - type: object - map_map_string: + map_of_map_property: additionalProperties: additionalProperties: type: string type: object type: object - map_map_anytype: - additionalProperties: - additionalProperties: - properties: {} - type: object - type: object - type: object - anytype_1: - properties: {} - type: object - anytype_2: - type: object - anytype_3: - properties: {} - type: object - type: object - AdditionalPropertiesString: - additionalProperties: - type: string - properties: - name: - type: string - type: object - AdditionalPropertiesInteger: - additionalProperties: - type: integer - properties: - name: - type: string - type: object - AdditionalPropertiesNumber: - additionalProperties: - type: number - properties: - name: - type: string - type: object - AdditionalPropertiesBoolean: - additionalProperties: - type: boolean - properties: - name: - type: string - type: object - AdditionalPropertiesArray: - additionalProperties: - items: - properties: {} - type: object - type: array - properties: - name: - type: string - type: object - AdditionalPropertiesObject: - additionalProperties: - additionalProperties: - properties: {} - type: object - type: object - properties: - name: - type: string - type: object - AdditionalPropertiesAnyType: - additionalProperties: - properties: {} - type: object - properties: - name: - type: string type: object MixedPropertiesAndAdditionalPropertiesClass: properties: @@ -1826,6 +1979,8 @@ components: array_of_string: items: type: string + maxItems: 3 + minItems: 0 type: array array_array_of_integer: items: @@ -1877,12 +2032,43 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + example: 2 + type: integer + OuterEnumDefaultValue: + default: placed enum: - placed - approved - delivered type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer OuterComposite: example: my_string: my_string @@ -1904,6 +2090,29 @@ components: OuterBoolean: type: boolean x-codegen-body-parameter-name: boolean_post_body + ParentWithNullable: + discriminator: + propertyName: type + properties: + type: + enum: + - ChildWithNullable + type: string + nullableProperty: + nullable: true + type: string + type: object + ChildWithNullable: + allOf: + - $ref: '#/components/schemas/ParentWithNullable' + - properties: + otherProperty: + type: string + type: object + example: + otherProperty: otherProperty + nullableProperty: nullableProperty + type: ChildWithNullable StringBooleanMap: additionalProperties: type: boolean @@ -1932,243 +2141,133 @@ components: description: Test capitalization type: string type: object - TypeHolderDefault: + _special_model.name_: properties: - string_item: - default: what - type: string - number_item: - type: number - integer_item: + $special[property.name]: + format: int64 type: integer - bool_item: - default: true - type: boolean - array_item: - items: - type: integer - type: array - required: - - array_item - - bool_item - - integer_item - - number_item - - string_item - type: object - TypeHolderExample: + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage properties: - string_item: - example: what + NullableMessage: + nullable: true type: string - number_item: - example: 1.234 - type: number - float_item: - example: 1.234 - format: float - type: number - integer_item: - example: -2 - type: integer - bool_item: - example: true - type: boolean - array_item: - example: - - 0 - - 1 - - 2 - - 3 - items: - type: integer - type: array - required: - - array_item - - bool_item - - float_item - - integer_item - - number_item - - string_item type: object - XmlItem: + NullableClass: + additionalProperties: + nullable: true + type: object properties: - attribute_string: - example: string - type: string - xml: - attribute: true - attribute_number: - example: 1.234 - type: number - xml: - attribute: true - attribute_integer: - example: -2 + integer_prop: + nullable: true type: integer - xml: - attribute: true - attribute_boolean: - example: true - type: boolean - xml: - attribute: true - wrapped_array: - items: - type: integer - type: array - xml: - wrapped: true - name_string: - example: string - type: string - xml: - name: xml_name_string - name_number: - example: 1.234 + number_prop: + nullable: true type: number - xml: - name: xml_name_number - name_integer: - example: -2 - type: integer - xml: - name: xml_name_integer - name_boolean: - example: true + boolean_prop: + nullable: true type: boolean - xml: - name: xml_name_boolean - name_array: - items: - type: integer - xml: - name: xml_name_array_item - type: array - name_wrapped_array: - items: - type: integer - xml: - name: xml_name_wrapped_array_item - type: array - xml: - name: xml_name_wrapped_array - wrapped: true - prefix_string: - example: string + string_prop: + nullable: true type: string - xml: - prefix: ab - prefix_number: - example: 1.234 - type: number - xml: - prefix: cd - prefix_integer: - example: -2 - type: integer - xml: - prefix: ef - prefix_boolean: - example: true - type: boolean - xml: - prefix: gh - prefix_array: - items: - type: integer - xml: - prefix: ij - type: array - prefix_wrapped_array: + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: items: - type: integer - xml: - prefix: mn + type: object + nullable: true type: array - xml: - prefix: kl - wrapped: true - namespace_string: - example: string - type: string - xml: - namespace: http://a.com/schema - namespace_number: - example: 1.234 - type: number - xml: - namespace: http://b.com/schema - namespace_integer: - example: -2 - type: integer - xml: - namespace: http://c.com/schema - namespace_boolean: - example: true - type: boolean - xml: - namespace: http://d.com/schema - namespace_array: + array_and_items_nullable_prop: items: - type: integer - xml: - namespace: http://e.com/schema + nullable: true + type: object + nullable: true type: array - namespace_wrapped_array: + array_items_nullable: items: - type: integer - xml: - namespace: http://g.com/schema + nullable: true + type: object type: array - xml: - namespace: http://f.com/schema - wrapped: true - prefix_ns_string: - example: string + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + type: object + type: object + OuterObjectWithEnumProperty: + example: + value: 2 + properties: + value: + $ref: '#/components/schemas/OuterEnumInteger' + required: + - value + type: object + DeprecatedObject: + deprecated: true + properties: + name: type: string - xml: - namespace: http://a.com/schema - prefix: a - prefix_ns_number: - example: 1.234 + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true type: number - xml: - namespace: http://b.com/schema - prefix: b - prefix_ns_integer: - example: -2 - type: integer - xml: - namespace: http://c.com/schema - prefix: c - prefix_ns_boolean: - example: true - type: boolean - xml: - namespace: http://d.com/schema - prefix: d - prefix_ns_array: - items: - type: integer - xml: - namespace: http://e.com/schema - prefix: e - type: array - prefix_ns_wrapped_array: + deprecatedRef: + $ref: '#/components/schemas/DeprecatedObject' + bars: + deprecated: true items: - type: integer - xml: - namespace: http://g.com/schema - prefix: g + $ref: '#/components/schemas/Bar' type: array - xml: - namespace: http://f.com/schema - prefix: f - wrapped: true type: object - xml: - namespace: http://a.com/schema - prefix: pre + AllOfWithSingleRef: + properties: + username: + type: string + SingleRefType: + allOf: + - $ref: '#/components/schemas/SingleRefType' + type: object + SingleRefType: + enum: + - admin + - user + title: SingleRefType + type: string + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + type: object updatePetWithForm_request: properties: name: @@ -2212,7 +2311,6 @@ components: properties: integer: description: None - format: int32 maximum: 100 minimum: 10 type: integer @@ -2281,6 +2379,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: @@ -2293,6 +2404,12 @@ components: - param - param2 type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object uploadFileWithRequiredFile_request: properties: additionalMetadata: @@ -2325,4 +2442,10 @@ components: http_basic_test: scheme: basic type: http -x-original-swagger-version: "2.0" + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + http_signature_test: + scheme: signature + type: http diff --git a/samples/server/petstore/kotlin-spring-cloud/.openapi-generator-ignore b/samples/server/petstore/kotlin-spring-cloud/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-cloud/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/kotlin-spring-cloud/.openapi-generator/FILES b/samples/server/petstore/kotlin-spring-cloud/.openapi-generator/FILES similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/.openapi-generator/FILES rename to samples/server/petstore/kotlin-spring-cloud/.openapi-generator/FILES diff --git a/samples/server/petstore/kotlin-spring-cloud/.openapi-generator/VERSION b/samples/server/petstore/kotlin-spring-cloud/.openapi-generator/VERSION new file mode 100644 index 000000000000..ecb21862b1ee --- /dev/null +++ b/samples/server/petstore/kotlin-spring-cloud/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.6.0-SNAPSHOT diff --git a/samples/client/petstore/kotlin-spring-cloud/README.md b/samples/server/petstore/kotlin-spring-cloud/README.md similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/README.md rename to samples/server/petstore/kotlin-spring-cloud/README.md diff --git a/samples/client/petstore/kotlin-spring-cloud/build.gradle.kts b/samples/server/petstore/kotlin-spring-cloud/build.gradle.kts similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/build.gradle.kts rename to samples/server/petstore/kotlin-spring-cloud/build.gradle.kts diff --git a/samples/client/petstore/kotlin-spring-cloud/pom.xml b/samples/server/petstore/kotlin-spring-cloud/pom.xml similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/pom.xml rename to samples/server/petstore/kotlin-spring-cloud/pom.xml diff --git a/samples/client/petstore/kotlin-spring-cloud/settings.gradle b/samples/server/petstore/kotlin-spring-cloud/settings.gradle similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/settings.gradle rename to samples/server/petstore/kotlin-spring-cloud/settings.gradle diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApiClient.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApiClient.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApiClient.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApiClient.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApi.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApi.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApi.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApiClient.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApiClient.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApiClient.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApiClient.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApi.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApi.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApi.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApiClient.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApiClient.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApiClient.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApiClient.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/configuration/ApiKeyRequestInterceptor.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/configuration/ApiKeyRequestInterceptor.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/configuration/ApiKeyRequestInterceptor.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/configuration/ApiKeyRequestInterceptor.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/configuration/ClientConfiguration.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/configuration/ClientConfiguration.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/configuration/ClientConfiguration.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/configuration/ClientConfiguration.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt diff --git a/samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt similarity index 100% rename from samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt rename to samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt diff --git a/samples/server/petstore/php-flight/Api/AbstractPetApi.php b/samples/server/petstore/php-flight/Api/AbstractPetApi.php index f895ed6e2734..949e7d1f2f1a 100644 --- a/samples/server/petstore/php-flight/Api/AbstractPetApi.php +++ b/samples/server/petstore/php-flight/Api/AbstractPetApi.php @@ -23,7 +23,8 @@ abstract class AbstractPetApi /** * Operation addPet - * Path: /pet + * + * Path: `/pet` * * Add a new pet to the store * @@ -36,9 +37,24 @@ public function addPet(\OpenAPIServer\Model\Pet $pet): \OpenAPIServer\Model\Pet| throw new \Exception('Not implemented'); } + /** + * Operation addPet (stream) + * + * Path: `/pet` + * + * Add a new pet to the store + * + * @param \OpenAPIServer\Model\Pet $pet Pet object that needs to be added to the store (required) + * + */ + public function addPetStream(\OpenAPIServer\Model\Pet $pet): void + { + throw new \Exception('Not implemented'); + } /** * Operation deletePet - * Path: /pet/{petId} + * + * Path: `/pet/{petId}` * * Deletes a pet * @@ -52,9 +68,25 @@ public function deletePet(int $petId, ?string $apiKey): void throw new \Exception('Not implemented'); } + /** + * Operation deletePet (stream) + * + * Path: `/pet/{petId}` + * + * Deletes a pet + * + * @param int $petId Pet id to delete (required) + * @param ?string $apiKey (optional) + * + */ + public function deletePetStream(int $petId, ?string $apiKey): void + { + throw new \Exception('Not implemented'); + } /** * Operation findPetsByStatus - * Path: /pet/findByStatus + * + * Path: `/pet/findByStatus` * * Finds Pets by status * @@ -70,6 +102,8 @@ public function findPetsByStatus(array $status): array|null /** * Operation findPetsByStatus (stream) * + * Path: `/pet/findByStatus` + * * Finds Pets by status * * @param array $status Status values that need to be considered for filter (required) (deprecated) @@ -81,7 +115,8 @@ public function findPetsByStatusStream(array $status): void } /** * Operation findPetsByTags - * Path: /pet/findByTags + * + * Path: `/pet/findByTags` * * Finds Pets by tags * @@ -98,6 +133,8 @@ public function findPetsByTags(array $tags): array|null /** * Operation findPetsByTags (stream) * + * Path: `/pet/findByTags` + * * Finds Pets by tags * * @param array $tags Tags to filter by (required) @@ -110,7 +147,8 @@ public function findPetsByTagsStream(array $tags): void } /** * Operation getPetById - * Path: /pet/{petId} + * + * Path: `/pet/{petId}` * * Find pet by ID * @@ -123,9 +161,24 @@ public function getPetById(int $petId): \OpenAPIServer\Model\Pet|null throw new \Exception('Not implemented'); } + /** + * Operation getPetById (stream) + * + * Path: `/pet/{petId}` + * + * Find pet by ID + * + * @param int $petId ID of pet to return (required) + * + */ + public function getPetByIdStream(int $petId): void + { + throw new \Exception('Not implemented'); + } /** * Operation updatePet - * Path: /pet + * + * Path: `/pet` * * Update an existing pet * @@ -138,9 +191,24 @@ public function updatePet(\OpenAPIServer\Model\Pet $pet): \OpenAPIServer\Model\P throw new \Exception('Not implemented'); } + /** + * Operation updatePet (stream) + * + * Path: `/pet` + * + * Update an existing pet + * + * @param \OpenAPIServer\Model\Pet $pet Pet object that needs to be added to the store (required) + * + */ + public function updatePetStream(\OpenAPIServer\Model\Pet $pet): void + { + throw new \Exception('Not implemented'); + } /** * Operation updatePetWithForm - * Path: /pet/{petId} + * + * Path: `/pet/{petId}` * * Updates a pet in the store with form data * @@ -153,9 +221,24 @@ public function updatePetWithForm(int $petId): void throw new \Exception('Not implemented'); } + /** + * Operation updatePetWithForm (stream) + * + * Path: `/pet/{petId}` + * + * Updates a pet in the store with form data + * + * @param int $petId ID of pet that needs to be updated (required) + * + */ + public function updatePetWithFormStream(int $petId): void + { + throw new \Exception('Not implemented'); + } /** * Operation uploadFile - * Path: /pet/{petId}/uploadImage + * + * Path: `/pet/{petId}/uploadImage` * * uploads an image * @@ -168,4 +251,18 @@ public function uploadFile(int $petId): \OpenAPIServer\Model\ApiResponse|null throw new \Exception('Not implemented'); } + /** + * Operation uploadFile (stream) + * + * Path: `/pet/{petId}/uploadImage` + * + * uploads an image + * + * @param int $petId ID of pet to update (required) + * + */ + public function uploadFileStream(int $petId): void + { + throw new \Exception('Not implemented'); + } } diff --git a/samples/server/petstore/php-flight/Api/AbstractStoreApi.php b/samples/server/petstore/php-flight/Api/AbstractStoreApi.php index 9c78d8b22b64..6bcc04d92020 100644 --- a/samples/server/petstore/php-flight/Api/AbstractStoreApi.php +++ b/samples/server/petstore/php-flight/Api/AbstractStoreApi.php @@ -23,7 +23,8 @@ abstract class AbstractStoreApi /** * Operation deleteOrder - * Path: /store/order/{orderId} + * + * Path: `/store/order/{orderId}` * * Delete purchase order by ID * @@ -36,9 +37,24 @@ public function deleteOrder(string $orderId): void throw new \Exception('Not implemented'); } + /** + * Operation deleteOrder (stream) + * + * Path: `/store/order/{orderId}` + * + * Delete purchase order by ID + * + * @param string $orderId ID of the order that needs to be deleted (required) + * + */ + public function deleteOrderStream(string $orderId): void + { + throw new \Exception('Not implemented'); + } /** * Operation getInventory - * Path: /store/inventory + * + * Path: `/store/inventory` * * Returns pet inventories by status * @@ -53,6 +69,8 @@ public function getInventory(): void /** * Operation getInventory (stream) * + * Path: `/store/inventory` + * * Returns pet inventories by status * * @@ -63,7 +81,8 @@ public function getInventoryStream(): void } /** * Operation getOrderById - * Path: /store/order/{orderId} + * + * Path: `/store/order/{orderId}` * * Find purchase order by ID * @@ -76,9 +95,24 @@ public function getOrderById(int $orderId): \OpenAPIServer\Model\Order|null throw new \Exception('Not implemented'); } + /** + * Operation getOrderById (stream) + * + * Path: `/store/order/{orderId}` + * + * Find purchase order by ID + * + * @param int $orderId ID of pet that needs to be fetched (required) + * + */ + public function getOrderByIdStream(int $orderId): void + { + throw new \Exception('Not implemented'); + } /** * Operation placeOrder - * Path: /store/order + * + * Path: `/store/order` * * Place an order for a pet * @@ -91,4 +125,18 @@ public function placeOrder(\OpenAPIServer\Model\Order $order): \OpenAPIServer\Mo throw new \Exception('Not implemented'); } + /** + * Operation placeOrder (stream) + * + * Path: `/store/order` + * + * Place an order for a pet + * + * @param \OpenAPIServer\Model\Order $order order placed for purchasing the pet (required) + * + */ + public function placeOrderStream(\OpenAPIServer\Model\Order $order): void + { + throw new \Exception('Not implemented'); + } } diff --git a/samples/server/petstore/php-flight/Api/AbstractUserApi.php b/samples/server/petstore/php-flight/Api/AbstractUserApi.php index 637a299b5e9e..66a16706268a 100644 --- a/samples/server/petstore/php-flight/Api/AbstractUserApi.php +++ b/samples/server/petstore/php-flight/Api/AbstractUserApi.php @@ -23,7 +23,8 @@ abstract class AbstractUserApi /** * Operation createUser - * Path: /user + * + * Path: `/user` * * Create user * @@ -36,9 +37,24 @@ public function createUser(\OpenAPIServer\Model\User $user): void throw new \Exception('Not implemented'); } + /** + * Operation createUser (stream) + * + * Path: `/user` + * + * Create user + * + * @param \OpenAPIServer\Model\User $user Created user object (required) + * + */ + public function createUserStream(\OpenAPIServer\Model\User $user): void + { + throw new \Exception('Not implemented'); + } /** * Operation createUsersWithArrayInput - * Path: /user/createWithArray + * + * Path: `/user/createWithArray` * * Creates list of users with given input array * @@ -51,9 +67,24 @@ public function createUsersWithArrayInput(array $user): void throw new \Exception('Not implemented'); } + /** + * Operation createUsersWithArrayInput (stream) + * + * Path: `/user/createWithArray` + * + * Creates list of users with given input array + * + * @param array $user List of user object (required) + * + */ + public function createUsersWithArrayInputStream(array $user): void + { + throw new \Exception('Not implemented'); + } /** * Operation createUsersWithListInput - * Path: /user/createWithList + * + * Path: `/user/createWithList` * * Creates list of users with given input array * @@ -66,9 +97,24 @@ public function createUsersWithListInput(array $user): void throw new \Exception('Not implemented'); } + /** + * Operation createUsersWithListInput (stream) + * + * Path: `/user/createWithList` + * + * Creates list of users with given input array + * + * @param array $user List of user object (required) + * + */ + public function createUsersWithListInputStream(array $user): void + { + throw new \Exception('Not implemented'); + } /** * Operation deleteUser - * Path: /user/{username} + * + * Path: `/user/{username}` * * Delete user * @@ -81,9 +127,24 @@ public function deleteUser(string $username): void throw new \Exception('Not implemented'); } + /** + * Operation deleteUser (stream) + * + * Path: `/user/{username}` + * + * Delete user + * + * @param string $username The name that needs to be deleted (required) + * + */ + public function deleteUserStream(string $username): void + { + throw new \Exception('Not implemented'); + } /** * Operation getUserByName - * Path: /user/{username} + * + * Path: `/user/{username}` * * Get user by user name * @@ -96,9 +157,24 @@ public function getUserByName(string $username): \OpenAPIServer\Model\User|null throw new \Exception('Not implemented'); } + /** + * Operation getUserByName (stream) + * + * Path: `/user/{username}` + * + * Get user by user name + * + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * + */ + public function getUserByNameStream(string $username): void + { + throw new \Exception('Not implemented'); + } /** * Operation loginUser - * Path: /user/login + * + * Path: `/user/login` * * Logs user into the system * @@ -112,9 +188,25 @@ public function loginUser(string $username, string $password): string|null throw new \Exception('Not implemented'); } + /** + * Operation loginUser (stream) + * + * Path: `/user/login` + * + * Logs user into the system + * + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) + * + */ + public function loginUserStream(string $username, string $password): void + { + throw new \Exception('Not implemented'); + } /** * Operation logoutUser - * Path: /user/logout + * + * Path: `/user/logout` * * Logs out current logged in user session * @@ -126,9 +218,23 @@ public function logoutUser(): void throw new \Exception('Not implemented'); } + /** + * Operation logoutUser (stream) + * + * Path: `/user/logout` + * + * Logs out current logged in user session + * + * + */ + public function logoutUserStream(): void + { + throw new \Exception('Not implemented'); + } /** * Operation updateUser - * Path: /user/{username} + * + * Path: `/user/{username}` * * Updated user * @@ -142,4 +248,19 @@ public function updateUser(string $username, \OpenAPIServer\Model\User $user): v throw new \Exception('Not implemented'); } + /** + * Operation updateUser (stream) + * + * Path: `/user/{username}` + * + * Updated user + * + * @param string $username name that need to be deleted (required) + * @param \OpenAPIServer\Model\User $user Updated user object (required) + * + */ + public function updateUserStream(string $username, \OpenAPIServer\Model\User $user): void + { + throw new \Exception('Not implemented'); + } } diff --git a/samples/server/petstore/php-flight/RegisterRoutes.php b/samples/server/petstore/php-flight/RegisterRoutes.php index 0ac69e994571..abae0ec3bd8f 100644 --- a/samples/server/petstore/php-flight/RegisterRoutes.php +++ b/samples/server/petstore/php-flight/RegisterRoutes.php @@ -33,12 +33,21 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\Pet') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } + if (declaresMethod($reflectionClass, 'addPetStream')) { + \Flight::route('POST /pet', function () use ($handler) { + $r = \Flight::request(); + $handler->addPetStream( + parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\Pet') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); + } if (declaresMethod($reflectionClass, 'deletePet') && declaresMethod($reflectionClass, 'deletePetStream')) { throw new \Exception('Operation deletePet cannot be both streaming and non-streaming'); @@ -50,9 +59,19 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($petId, 'int'), parseParam($r->getHeader('api_key'), '?string') ); - \Flight::halt(204); + \Flight::halt(400); }); } + if (declaresMethod($reflectionClass, 'deletePetStream')) { + \Flight::route('DELETE /pet/@petId', function (string $petId) use ($handler) { + $r = \Flight::request(); + $handler->deletePetStream( + parseParam($petId, 'int'), + parseParam($r->getHeader('api_key'), '?string') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 400]); + } if (declaresMethod($reflectionClass, 'findPetsByStatus') && declaresMethod($reflectionClass, 'findPetsByStatusStream')) { throw new \Exception('Operation findPetsByStatus cannot be both streaming and non-streaming'); @@ -64,9 +83,9 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($r->query['status'] ?? null, '\\OpenAPIServer\\Model\\FindPetsByStatusStatusParameterInner[]') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } @@ -77,7 +96,7 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($r->query['status'] ?? null, '\\OpenAPIServer\\Model\\FindPetsByStatusStatusParameterInner[]') ); // ignore return value: streaming expected - })->streamWithHeaders(['Content-Type' => 'application/json']); + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); } if (declaresMethod($reflectionClass, 'findPetsByTags') && declaresMethod($reflectionClass, 'findPetsByTagsStream')) { @@ -90,9 +109,9 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($r->query['tags'] ?? null, 'string[]') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } @@ -103,7 +122,7 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($r->query['tags'] ?? null, 'string[]') ); // ignore return value: streaming expected - })->streamWithHeaders(['Content-Type' => 'application/json']); + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); } if (declaresMethod($reflectionClass, 'getPetById') && declaresMethod($reflectionClass, 'getPetByIdStream')) { @@ -116,12 +135,21 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($petId, 'int') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } + if (declaresMethod($reflectionClass, 'getPetByIdStream')) { + \Flight::route('GET /pet/@petId', function (string $petId) use ($handler) { + $r = \Flight::request(); + $handler->getPetByIdStream( + parseParam($petId, 'int') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); + } if (declaresMethod($reflectionClass, 'updatePet') && declaresMethod($reflectionClass, 'updatePetStream')) { throw new \Exception('Operation updatePet cannot be both streaming and non-streaming'); @@ -133,12 +161,21 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\Pet') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } + if (declaresMethod($reflectionClass, 'updatePetStream')) { + \Flight::route('PUT /pet', function () use ($handler) { + $r = \Flight::request(); + $handler->updatePetStream( + parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\Pet') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); + } if (declaresMethod($reflectionClass, 'updatePetWithForm') && declaresMethod($reflectionClass, 'updatePetWithFormStream')) { throw new \Exception('Operation updatePetWithForm cannot be both streaming and non-streaming'); @@ -149,9 +186,18 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $handler->updatePetWithForm( parseParam($petId, 'int') ); - \Flight::halt(204); + \Flight::halt(405); }); } + if (declaresMethod($reflectionClass, 'updatePetWithFormStream')) { + \Flight::route('POST /pet/@petId', function (string $petId) use ($handler) { + $r = \Flight::request(); + $handler->updatePetWithFormStream( + parseParam($petId, 'int') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 405]); + } if (declaresMethod($reflectionClass, 'uploadFile') && declaresMethod($reflectionClass, 'uploadFileStream')) { throw new \Exception('Operation uploadFile cannot be both streaming and non-streaming'); @@ -163,12 +209,21 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($petId, 'int') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } + if (declaresMethod($reflectionClass, 'uploadFileStream')) { + \Flight::route('POST /pet/@petId/uploadImage', function (string $petId) use ($handler) { + $r = \Flight::request(); + $handler->uploadFileStream( + parseParam($petId, 'int') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); + } if (declaresMethod($reflectionClass, 'deleteOrder') && declaresMethod($reflectionClass, 'deleteOrderStream')) { throw new \Exception('Operation deleteOrder cannot be both streaming and non-streaming'); @@ -179,9 +234,18 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $handler->deleteOrder( parseParam($orderId, 'string') ); - \Flight::halt(204); + \Flight::halt(400); }); } + if (declaresMethod($reflectionClass, 'deleteOrderStream')) { + \Flight::route('DELETE /store/order/@orderId', function (string $orderId) use ($handler) { + $r = \Flight::request(); + $handler->deleteOrderStream( + parseParam($orderId, 'string') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 400]); + } if (declaresMethod($reflectionClass, 'getInventory') && declaresMethod($reflectionClass, 'getInventoryStream')) { throw new \Exception('Operation getInventory cannot be both streaming and non-streaming'); @@ -191,7 +255,7 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $r = \Flight::request(); $handler->getInventory( ); - \Flight::halt(204); + \Flight::halt(200); }); } if (declaresMethod($reflectionClass, 'getInventoryStream')) { @@ -200,7 +264,7 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $handler->getInventoryStream( ); // ignore return value: streaming expected - })->streamWithHeaders(['Content-Type' => 'application/json']); + })->streamWithHeaders(['status' => 200]); } if (declaresMethod($reflectionClass, 'getOrderById') && declaresMethod($reflectionClass, 'getOrderByIdStream')) { @@ -213,12 +277,21 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($orderId, 'int') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } + if (declaresMethod($reflectionClass, 'getOrderByIdStream')) { + \Flight::route('GET /store/order/@orderId', function (string $orderId) use ($handler) { + $r = \Flight::request(); + $handler->getOrderByIdStream( + parseParam($orderId, 'int') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); + } if (declaresMethod($reflectionClass, 'placeOrder') && declaresMethod($reflectionClass, 'placeOrderStream')) { throw new \Exception('Operation placeOrder cannot be both streaming and non-streaming'); @@ -230,12 +303,21 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\Order') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } + if (declaresMethod($reflectionClass, 'placeOrderStream')) { + \Flight::route('POST /store/order', function () use ($handler) { + $r = \Flight::request(); + $handler->placeOrderStream( + parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\Order') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); + } if (declaresMethod($reflectionClass, 'createUser') && declaresMethod($reflectionClass, 'createUserStream')) { throw new \Exception('Operation createUser cannot be both streaming and non-streaming'); @@ -246,9 +328,18 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $handler->createUser( parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\User') ); - \Flight::halt(204); + \Flight::halt(200); }); } + if (declaresMethod($reflectionClass, 'createUserStream')) { + \Flight::route('POST /user', function () use ($handler) { + $r = \Flight::request(); + $handler->createUserStream( + parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\User') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200]); + } if (declaresMethod($reflectionClass, 'createUsersWithArrayInput') && declaresMethod($reflectionClass, 'createUsersWithArrayInputStream')) { throw new \Exception('Operation createUsersWithArrayInput cannot be both streaming and non-streaming'); @@ -259,9 +350,18 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $handler->createUsersWithArrayInput( parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\User[]') ); - \Flight::halt(204); + \Flight::halt(200); }); } + if (declaresMethod($reflectionClass, 'createUsersWithArrayInputStream')) { + \Flight::route('POST /user/createWithArray', function () use ($handler) { + $r = \Flight::request(); + $handler->createUsersWithArrayInputStream( + parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\User[]') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200]); + } if (declaresMethod($reflectionClass, 'createUsersWithListInput') && declaresMethod($reflectionClass, 'createUsersWithListInputStream')) { throw new \Exception('Operation createUsersWithListInput cannot be both streaming and non-streaming'); @@ -272,9 +372,18 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $handler->createUsersWithListInput( parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\User[]') ); - \Flight::halt(204); + \Flight::halt(200); }); } + if (declaresMethod($reflectionClass, 'createUsersWithListInputStream')) { + \Flight::route('POST /user/createWithList', function () use ($handler) { + $r = \Flight::request(); + $handler->createUsersWithListInputStream( + parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\User[]') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200]); + } if (declaresMethod($reflectionClass, 'deleteUser') && declaresMethod($reflectionClass, 'deleteUserStream')) { throw new \Exception('Operation deleteUser cannot be both streaming and non-streaming'); @@ -285,9 +394,18 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $handler->deleteUser( parseParam($username, 'string') ); - \Flight::halt(204); + \Flight::halt(400); }); } + if (declaresMethod($reflectionClass, 'deleteUserStream')) { + \Flight::route('DELETE /user/@username', function (string $username) use ($handler) { + $r = \Flight::request(); + $handler->deleteUserStream( + parseParam($username, 'string') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 400]); + } if (declaresMethod($reflectionClass, 'getUserByName') && declaresMethod($reflectionClass, 'getUserByNameStream')) { throw new \Exception('Operation getUserByName cannot be both streaming and non-streaming'); @@ -299,12 +417,21 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($username, 'string') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } + if (declaresMethod($reflectionClass, 'getUserByNameStream')) { + \Flight::route('GET /user/@username', function (string $username) use ($handler) { + $r = \Flight::request(); + $handler->getUserByNameStream( + parseParam($username, 'string') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); + } if (declaresMethod($reflectionClass, 'loginUser') && declaresMethod($reflectionClass, 'loginUserStream')) { throw new \Exception('Operation loginUser cannot be both streaming and non-streaming'); @@ -317,12 +444,22 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($r->query['password'] ?? null, 'string') ); if ($result === null) { - \Flight::halt(204); + \Flight::halt(200); } else { - \Flight::json($result); + \Flight::json($result, 200); } }); } + if (declaresMethod($reflectionClass, 'loginUserStream')) { + \Flight::route('GET /user/login', function () use ($handler) { + $r = \Flight::request(); + $handler->loginUserStream( + parseParam($r->query['username'] ?? null, 'string'), + parseParam($r->query['password'] ?? null, 'string') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200, 'Content-Type' => 'application/json']); + } if (declaresMethod($reflectionClass, 'logoutUser') && declaresMethod($reflectionClass, 'logoutUserStream')) { throw new \Exception('Operation logoutUser cannot be both streaming and non-streaming'); @@ -332,9 +469,17 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI $r = \Flight::request(); $handler->logoutUser( ); - \Flight::halt(204); + \Flight::halt(200); }); } + if (declaresMethod($reflectionClass, 'logoutUserStream')) { + \Flight::route('GET /user/logout', function () use ($handler) { + $r = \Flight::request(); + $handler->logoutUserStream( + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 200]); + } if (declaresMethod($reflectionClass, 'updateUser') && declaresMethod($reflectionClass, 'updateUserStream')) { throw new \Exception('Operation updateUser cannot be both streaming and non-streaming'); @@ -346,9 +491,19 @@ static public function registerRoutes(\OpenAPIServer\Api\AbstractPetApi|\OpenAPI parseParam($username, 'string'), parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\User') ); - \Flight::halt(204); + \Flight::halt(400); }); } + if (declaresMethod($reflectionClass, 'updateUserStream')) { + \Flight::route('PUT /user/@username', function (string $username) use ($handler) { + $r = \Flight::request(); + $handler->updateUserStream( + parseParam($username, 'string'), + parseParam(json_decode($r->getBody(), true), '\\OpenAPIServer\\Model\\User') + ); + // ignore return value: streaming expected + })->streamWithHeaders(['status' => 400]); + } } } diff --git a/samples/server/petstore/python-fastapi/requirements.txt b/samples/server/petstore/python-fastapi/requirements.txt index f33ba924deca..f7c286439a09 100644 --- a/samples/server/petstore/python-fastapi/requirements.txt +++ b/samples/server/petstore/python-fastapi/requirements.txt @@ -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/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/README.md b/samples/server/petstore/rust-axum/output/multipart-v3/README.md index f4f456c04bd6..68f1c75bf6ca 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/README.md +++ b/samples/server/petstore/rust-axum/output/multipart-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.7 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/README.md b/samples/server/petstore/rust-axum/output/openapi-v3/README.md index cce3ce70309e..20b9a33bcac4 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-axum/output/openapi-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.7 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ops-v3/README.md b/samples/server/petstore/rust-axum/output/ops-v3/README.md index 3cf44f6b0230..9be673f94408 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/README.md +++ b/samples/server/petstore/rust-axum/output/ops-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md index e48c2df3d016..69a87cb8bb12 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs index 5cc0e76a1a53..4d017097f1ae 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs @@ -445,6 +445,7 @@ pub trait Api { method: Method, host: Host, cookies: CookieJar, + body: models::TestEndpointParametersRequest, ) -> Result; /// To test enum parameters. @@ -457,6 +458,7 @@ pub trait Api { cookies: CookieJar, header_params: models::TestEnumParametersHeaderParams, query_params: models::TestEnumParametersQueryParams, + body: Option, ) -> Result; /// test inline additionalProperties. @@ -478,6 +480,7 @@ pub trait Api { method: Method, host: Host, cookies: CookieJar, + body: models::TestJsonFormDataRequest, ) -> Result; /// To test class name in snake case. @@ -567,6 +570,7 @@ pub trait Api { host: Host, cookies: CookieJar, path_params: models::UpdatePetWithFormPathParams, + body: Option, ) -> Result; /// uploads an image. diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs index ccd8f72ef78c..591189ae1f1d 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs @@ -5521,6 +5521,936 @@ impl std::convert::TryFrom for header::IntoHeaderValue { } } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct TestEndpointParametersRequest { + /// None + #[serde(rename = "integer")] + #[validate(range(min = 10, max = 100))] + #[serde(skip_serializing_if = "Option::is_none")] + pub integer: Option, + + /// None + #[serde(rename = "int32")] + #[validate(range(min = 20, max = 200))] + #[serde(skip_serializing_if = "Option::is_none")] + pub int32: Option, + + /// None + #[serde(rename = "int64")] + #[serde(skip_serializing_if = "Option::is_none")] + pub int64: Option, + + /// None + #[serde(rename = "number")] + #[validate(range(min = 32.1, max = 543.2))] + pub number: f64, + + /// None + #[serde(rename = "float")] + #[validate(range(max = 987.6))] + #[serde(skip_serializing_if = "Option::is_none")] + pub float: Option, + + /// None + #[serde(rename = "double")] + #[validate(range(min = 67.8, max = 123.4))] + pub double: f64, + + /// None + #[serde(rename = "string")] + #[validate( + regex(path = *RE_TESTENDPOINTPARAMETERSREQUEST_STRING), + )] + #[serde(skip_serializing_if = "Option::is_none")] + pub string: Option, + + /// None + #[serde(rename = "pattern_without_delimiter")] + #[validate( + regex(path = *RE_TESTENDPOINTPARAMETERSREQUEST_PATTERN_WITHOUT_DELIMITER), + )] + pub pattern_without_delimiter: String, + + /// None + #[serde(rename = "byte")] + pub byte: ByteArray, + + /// None + #[serde(rename = "binary")] + #[serde(skip_serializing_if = "Option::is_none")] + pub binary: Option, + + /// None + #[serde(rename = "date")] + #[serde(skip_serializing_if = "Option::is_none")] + pub date: Option, + + /// None + #[serde(rename = "dateTime")] + #[serde(skip_serializing_if = "Option::is_none")] + pub date_time: Option>, + + /// None + #[serde(rename = "password")] + #[validate(length(min = 10, max = 64))] + #[serde(skip_serializing_if = "Option::is_none")] + pub password: Option, + + /// None + #[serde(rename = "callback")] + #[serde(skip_serializing_if = "Option::is_none")] + pub callback: Option, +} + +lazy_static::lazy_static! { + static ref RE_TESTENDPOINTPARAMETERSREQUEST_STRING: regex::Regex = regex::Regex::new(r"/[a-z]/i").unwrap(); +} +lazy_static::lazy_static! { + static ref RE_TESTENDPOINTPARAMETERSREQUEST_PATTERN_WITHOUT_DELIMITER: regex::Regex = regex::Regex::new(r"^[A-Z].*").unwrap(); +} + +impl TestEndpointParametersRequest { + #[allow(clippy::new_without_default, clippy::too_many_arguments)] + pub fn new( + number: f64, + double: f64, + pattern_without_delimiter: String, + byte: ByteArray, + ) -> TestEndpointParametersRequest { + TestEndpointParametersRequest { + integer: None, + int32: None, + int64: None, + number, + float: None, + double, + string: None, + pattern_without_delimiter, + byte, + binary: None, + date: None, + date_time: None, + password: None, + callback: None, + } + } +} + +/// Converts the TestEndpointParametersRequest value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for TestEndpointParametersRequest { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let params: Vec> = vec![ + self.integer + .as_ref() + .map(|integer| ["integer".to_string(), integer.to_string()].join(",")), + self.int32 + .as_ref() + .map(|int32| ["int32".to_string(), int32.to_string()].join(",")), + self.int64 + .as_ref() + .map(|int64| ["int64".to_string(), int64.to_string()].join(",")), + Some("number".to_string()), + Some(self.number.to_string()), + self.float + .as_ref() + .map(|float| ["float".to_string(), float.to_string()].join(",")), + Some("double".to_string()), + Some(self.double.to_string()), + self.string + .as_ref() + .map(|string| ["string".to_string(), string.to_string()].join(",")), + Some("pattern_without_delimiter".to_string()), + Some(self.pattern_without_delimiter.to_string()), + // Skipping byte in query parameter serialization + // Skipping byte in query parameter serialization + + // Skipping binary in query parameter serialization + // Skipping binary in query parameter serialization + + // Skipping date in query parameter serialization + + // Skipping dateTime in query parameter serialization + self.password + .as_ref() + .map(|password| ["password".to_string(), password.to_string()].join(",")), + self.callback + .as_ref() + .map(|callback| ["callback".to_string(), callback.to_string()].join(",")), + ]; + + write!( + f, + "{}", + params.into_iter().flatten().collect::>().join(",") + ) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a TestEndpointParametersRequest value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for TestEndpointParametersRequest { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + /// An intermediate representation of the struct to use for parsing. + #[derive(Default)] + #[allow(dead_code)] + struct IntermediateRep { + pub integer: Vec, + pub int32: Vec, + pub int64: Vec, + pub number: Vec, + pub float: Vec, + pub double: Vec, + pub string: Vec, + pub pattern_without_delimiter: Vec, + pub byte: Vec, + pub binary: Vec, + pub date: Vec, + pub date_time: Vec>, + pub password: Vec, + pub callback: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(','); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => { + return std::result::Result::Err( + "Missing value while parsing TestEndpointParametersRequest".to_string(), + ) + } + }; + + if let Some(key) = key_result { + #[allow(clippy::match_single_binding)] + match key { + #[allow(clippy::redundant_clone)] + "integer" => intermediate_rep.integer.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "int32" => intermediate_rep.int32.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "int64" => intermediate_rep.int64.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "number" => intermediate_rep.number.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "float" => intermediate_rep.float.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "double" => intermediate_rep.double.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "string" => intermediate_rep.string.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "pattern_without_delimiter" => intermediate_rep.pattern_without_delimiter.push(::from_str(val).map_err(|x| x.to_string())?), + "byte" => return std::result::Result::Err("Parsing binary data in this style is not supported in TestEndpointParametersRequest".to_string()), + "binary" => return std::result::Result::Err("Parsing binary data in this style is not supported in TestEndpointParametersRequest".to_string()), + #[allow(clippy::redundant_clone)] + "date" => intermediate_rep.date.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "dateTime" => intermediate_rep.date_time.push( as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "password" => intermediate_rep.password.push(::from_str(val).map_err(|x| x.to_string())?), + #[allow(clippy::redundant_clone)] + "callback" => intermediate_rep.callback.push(::from_str(val).map_err(|x| x.to_string())?), + _ => return std::result::Result::Err("Unexpected key while parsing TestEndpointParametersRequest".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(TestEndpointParametersRequest { + integer: intermediate_rep.integer.into_iter().next(), + int32: intermediate_rep.int32.into_iter().next(), + int64: intermediate_rep.int64.into_iter().next(), + number: intermediate_rep + .number + .into_iter() + .next() + .ok_or_else(|| "number missing in TestEndpointParametersRequest".to_string())?, + float: intermediate_rep.float.into_iter().next(), + double: intermediate_rep + .double + .into_iter() + .next() + .ok_or_else(|| "double missing in TestEndpointParametersRequest".to_string())?, + string: intermediate_rep.string.into_iter().next(), + pattern_without_delimiter: intermediate_rep + .pattern_without_delimiter + .into_iter() + .next() + .ok_or_else(|| { + "pattern_without_delimiter missing in TestEndpointParametersRequest".to_string() + })?, + byte: intermediate_rep + .byte + .into_iter() + .next() + .ok_or_else(|| "byte missing in TestEndpointParametersRequest".to_string())?, + binary: intermediate_rep.binary.into_iter().next(), + date: intermediate_rep.date.into_iter().next(), + date_time: intermediate_rep.date_time.into_iter().next(), + password: intermediate_rep.password.into_iter().next(), + callback: intermediate_rep.callback.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and HeaderValue + +#[cfg(feature = "server")] +impl std::convert::TryFrom> for HeaderValue { + type Error = String; + + fn try_from( + hdr_value: header::IntoHeaderValue, + ) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Invalid header value for TestEndpointParametersRequest - value: {} is invalid {}", + hdr_value, e + )), + } + } +} + +#[cfg(feature = "server")] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into TestEndpointParametersRequest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct TestEnumParametersRequest { + /// Form parameter enum test (string) + /// Note: inline enums are not fully supported by openapi-generator + #[serde(rename = "enum_form_string")] + #[serde(skip_serializing_if = "Option::is_none")] + pub enum_form_string: Option, +} + +impl TestEnumParametersRequest { + #[allow(clippy::new_without_default, clippy::too_many_arguments)] + pub fn new() -> TestEnumParametersRequest { + TestEnumParametersRequest { + enum_form_string: Some("-efg".to_string()), + } + } +} + +/// Converts the TestEnumParametersRequest value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for TestEnumParametersRequest { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let params: Vec> = + vec![self.enum_form_string.as_ref().map(|enum_form_string| { + ["enum_form_string".to_string(), enum_form_string.to_string()].join(",") + })]; + + write!( + f, + "{}", + params.into_iter().flatten().collect::>().join(",") + ) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a TestEnumParametersRequest value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for TestEnumParametersRequest { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + /// An intermediate representation of the struct to use for parsing. + #[derive(Default)] + #[allow(dead_code)] + struct IntermediateRep { + pub enum_form_string: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(','); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => { + return std::result::Result::Err( + "Missing value while parsing TestEnumParametersRequest".to_string(), + ) + } + }; + + if let Some(key) = key_result { + #[allow(clippy::match_single_binding)] + match key { + #[allow(clippy::redundant_clone)] + "enum_form_string" => intermediate_rep.enum_form_string.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + _ => { + return std::result::Result::Err( + "Unexpected key while parsing TestEnumParametersRequest".to_string(), + ) + } + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(TestEnumParametersRequest { + enum_form_string: intermediate_rep.enum_form_string.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and HeaderValue + +#[cfg(feature = "server")] +impl std::convert::TryFrom> for HeaderValue { + type Error = String; + + fn try_from( + hdr_value: header::IntoHeaderValue, + ) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Invalid header value for TestEnumParametersRequest - value: {} is invalid {}", + hdr_value, e + )), + } + } +} + +#[cfg(feature = "server")] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => { + std::result::Result::Ok(header::IntoHeaderValue(value)) + } + std::result::Result::Err(err) => std::result::Result::Err(format!( + "Unable to convert header value '{}' into TestEnumParametersRequest - {}", + value, err + )), + } + } + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Unable to convert header: {:?} to string: {}", + hdr_value, e + )), + } + } +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct TestJsonFormDataRequest { + /// field1 + #[serde(rename = "param")] + pub param: String, + + /// field2 + #[serde(rename = "param2")] + pub param2: String, +} + +impl TestJsonFormDataRequest { + #[allow(clippy::new_without_default, clippy::too_many_arguments)] + pub fn new(param: String, param2: String) -> TestJsonFormDataRequest { + TestJsonFormDataRequest { param, param2 } + } +} + +/// Converts the TestJsonFormDataRequest value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for TestJsonFormDataRequest { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let params: Vec> = vec![ + Some("param".to_string()), + Some(self.param.to_string()), + Some("param2".to_string()), + Some(self.param2.to_string()), + ]; + + write!( + f, + "{}", + params.into_iter().flatten().collect::>().join(",") + ) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a TestJsonFormDataRequest value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for TestJsonFormDataRequest { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + /// An intermediate representation of the struct to use for parsing. + #[derive(Default)] + #[allow(dead_code)] + struct IntermediateRep { + pub param: Vec, + pub param2: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(','); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => { + return std::result::Result::Err( + "Missing value while parsing TestJsonFormDataRequest".to_string(), + ) + } + }; + + if let Some(key) = key_result { + #[allow(clippy::match_single_binding)] + match key { + #[allow(clippy::redundant_clone)] + "param" => intermediate_rep.param.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + #[allow(clippy::redundant_clone)] + "param2" => intermediate_rep.param2.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + _ => { + return std::result::Result::Err( + "Unexpected key while parsing TestJsonFormDataRequest".to_string(), + ) + } + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(TestJsonFormDataRequest { + param: intermediate_rep + .param + .into_iter() + .next() + .ok_or_else(|| "param missing in TestJsonFormDataRequest".to_string())?, + param2: intermediate_rep + .param2 + .into_iter() + .next() + .ok_or_else(|| "param2 missing in TestJsonFormDataRequest".to_string())?, + }) + } +} + +// Methods for converting between header::IntoHeaderValue and HeaderValue + +#[cfg(feature = "server")] +impl std::convert::TryFrom> for HeaderValue { + type Error = String; + + fn try_from( + hdr_value: header::IntoHeaderValue, + ) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Invalid header value for TestJsonFormDataRequest - value: {} is invalid {}", + hdr_value, e + )), + } + } +} + +#[cfg(feature = "server")] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => { + std::result::Result::Ok(header::IntoHeaderValue(value)) + } + std::result::Result::Err(err) => std::result::Result::Err(format!( + "Unable to convert header value '{}' into TestJsonFormDataRequest - {}", + value, err + )), + } + } + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Unable to convert header: {:?} to string: {}", + hdr_value, e + )), + } + } +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct UpdatePetWithFormRequest { + /// Updated name of the pet + #[serde(rename = "name")] + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + /// Updated status of the pet + #[serde(rename = "status")] + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +impl UpdatePetWithFormRequest { + #[allow(clippy::new_without_default, clippy::too_many_arguments)] + pub fn new() -> UpdatePetWithFormRequest { + UpdatePetWithFormRequest { + name: None, + status: None, + } + } +} + +/// Converts the UpdatePetWithFormRequest value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for UpdatePetWithFormRequest { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let params: Vec> = vec![ + self.name + .as_ref() + .map(|name| ["name".to_string(), name.to_string()].join(",")), + self.status + .as_ref() + .map(|status| ["status".to_string(), status.to_string()].join(",")), + ]; + + write!( + f, + "{}", + params.into_iter().flatten().collect::>().join(",") + ) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a UpdatePetWithFormRequest value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for UpdatePetWithFormRequest { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + /// An intermediate representation of the struct to use for parsing. + #[derive(Default)] + #[allow(dead_code)] + struct IntermediateRep { + pub name: Vec, + pub status: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(','); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => { + return std::result::Result::Err( + "Missing value while parsing UpdatePetWithFormRequest".to_string(), + ) + } + }; + + if let Some(key) = key_result { + #[allow(clippy::match_single_binding)] + match key { + #[allow(clippy::redundant_clone)] + "name" => intermediate_rep.name.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + #[allow(clippy::redundant_clone)] + "status" => intermediate_rep.status.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + _ => { + return std::result::Result::Err( + "Unexpected key while parsing UpdatePetWithFormRequest".to_string(), + ) + } + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(UpdatePetWithFormRequest { + name: intermediate_rep.name.into_iter().next(), + status: intermediate_rep.status.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and HeaderValue + +#[cfg(feature = "server")] +impl std::convert::TryFrom> for HeaderValue { + type Error = String; + + fn try_from( + hdr_value: header::IntoHeaderValue, + ) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Invalid header value for UpdatePetWithFormRequest - value: {} is invalid {}", + hdr_value, e + )), + } + } +} + +#[cfg(feature = "server")] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => { + std::result::Result::Ok(header::IntoHeaderValue(value)) + } + std::result::Result::Err(err) => std::result::Result::Err(format!( + "Unable to convert header value '{}' into UpdatePetWithFormRequest - {}", + value, err + )), + } + } + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Unable to convert header: {:?} to string: {}", + hdr_value, e + )), + } + } +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct UploadFileRequest { + /// Additional data to pass to server + #[serde(rename = "additionalMetadata")] + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_metadata: Option, + + /// file to upload + #[serde(rename = "file")] + #[serde(skip_serializing_if = "Option::is_none")] + pub file: Option, +} + +impl UploadFileRequest { + #[allow(clippy::new_without_default, clippy::too_many_arguments)] + pub fn new() -> UploadFileRequest { + UploadFileRequest { + additional_metadata: None, + file: None, + } + } +} + +/// Converts the UploadFileRequest value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for UploadFileRequest { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let params: Vec> = vec![ + self.additional_metadata + .as_ref() + .map(|additional_metadata| { + [ + "additionalMetadata".to_string(), + additional_metadata.to_string(), + ] + .join(",") + }), + // Skipping file in query parameter serialization + // Skipping file in query parameter serialization + ]; + + write!( + f, + "{}", + params.into_iter().flatten().collect::>().join(",") + ) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a UploadFileRequest value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for UploadFileRequest { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + /// An intermediate representation of the struct to use for parsing. + #[derive(Default)] + #[allow(dead_code)] + struct IntermediateRep { + pub additional_metadata: Vec, + pub file: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(','); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => { + return std::result::Result::Err( + "Missing value while parsing UploadFileRequest".to_string(), + ) + } + }; + + if let Some(key) = key_result { + #[allow(clippy::match_single_binding)] + match key { + #[allow(clippy::redundant_clone)] + "additionalMetadata" => intermediate_rep.additional_metadata.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + "file" => return std::result::Result::Err( + "Parsing binary data in this style is not supported in UploadFileRequest" + .to_string(), + ), + _ => { + return std::result::Result::Err( + "Unexpected key while parsing UploadFileRequest".to_string(), + ) + } + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(UploadFileRequest { + additional_metadata: intermediate_rep.additional_metadata.into_iter().next(), + file: intermediate_rep.file.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and HeaderValue + +#[cfg(feature = "server")] +impl std::convert::TryFrom> for HeaderValue { + type Error = String; + + fn try_from( + hdr_value: header::IntoHeaderValue, + ) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Invalid header value for UploadFileRequest - value: {} is invalid {}", + hdr_value, e + )), + } + } +} + +#[cfg(feature = "server")] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => { + std::result::Result::Ok(header::IntoHeaderValue(value)) + } + std::result::Result::Err(err) => std::result::Result::Err(format!( + "Unable to convert header value '{}' into UploadFileRequest - {}", + value, err + )), + } + } + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Unable to convert header: {:?} to string: {}", + hdr_value, e + )), + } + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct User { diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index cf0fe31c8130..e566756227e4 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -895,9 +895,21 @@ where }) } +#[derive(validator::Validate)] +#[allow(dead_code)] +struct TestEndpointParametersBodyValidator<'a> { + #[validate(nested)] + body: &'a models::TestEndpointParametersRequest, +} + #[tracing::instrument(skip_all)] -fn test_endpoint_parameters_validation() -> std::result::Result<(), ValidationErrors> { - Ok(()) +fn test_endpoint_parameters_validation( + body: models::TestEndpointParametersRequest, +) -> std::result::Result<(models::TestEndpointParametersRequest,), ValidationErrors> { + let b = TestEndpointParametersBodyValidator { body: &body }; + b.validate()?; + + Ok((body,)) } /// TestEndpointParameters - POST /v2/fake #[tracing::instrument(skip_all)] @@ -906,17 +918,18 @@ async fn test_endpoint_parameters( host: Host, cookies: CookieJar, State(api_impl): State, + Form(body): Form, ) -> Result where I: AsRef + Send + Sync, A: Api, { #[allow(clippy::redundant_closure)] - let validation = tokio::task::spawn_blocking(move || test_endpoint_parameters_validation()) + let validation = tokio::task::spawn_blocking(move || test_endpoint_parameters_validation(body)) .await .unwrap(); - let Ok(()) = validation else { + let Ok((body,)) = validation else { return Response::builder() .status(StatusCode::BAD_REQUEST) .body(Body::from(validation.unwrap_err().to_string())) @@ -925,7 +938,7 @@ where let result = api_impl .as_ref() - .test_endpoint_parameters(method, host, cookies) + .test_endpoint_parameters(method, host, cookies, body) .await; let mut response = Response::builder(); @@ -954,21 +967,34 @@ where }) } +#[derive(validator::Validate)] +#[allow(dead_code)] +struct TestEnumParametersBodyValidator<'a> { + #[validate(nested)] + body: &'a models::TestEnumParametersRequest, +} + #[tracing::instrument(skip_all)] fn test_enum_parameters_validation( header_params: models::TestEnumParametersHeaderParams, query_params: models::TestEnumParametersQueryParams, + body: Option, ) -> std::result::Result< ( models::TestEnumParametersHeaderParams, models::TestEnumParametersQueryParams, + Option, ), ValidationErrors, > { header_params.validate()?; query_params.validate()?; + if let Some(body) = &body { + let b = TestEnumParametersBodyValidator { body }; + b.validate()?; + } - Ok((header_params, query_params)) + Ok((header_params, query_params, body)) } /// TestEnumParameters - GET /v2/fake #[tracing::instrument(skip_all)] @@ -979,6 +1005,7 @@ async fn test_enum_parameters( headers: HeaderMap, Query(query_params): Query, State(api_impl): State, + Form(body): Form>, ) -> Result where I: AsRef + Send + Sync, @@ -1036,12 +1063,12 @@ where #[allow(clippy::redundant_closure)] let validation = tokio::task::spawn_blocking(move || { - test_enum_parameters_validation(header_params, query_params) + test_enum_parameters_validation(header_params, query_params, body) }) .await .unwrap(); - let Ok((header_params, query_params)) = validation else { + let Ok((header_params, query_params, body)) = validation else { return Response::builder() .status(StatusCode::BAD_REQUEST) .body(Body::from(validation.unwrap_err().to_string())) @@ -1050,7 +1077,7 @@ where let result = api_impl .as_ref() - .test_enum_parameters(method, host, cookies, header_params, query_params) + .test_enum_parameters(method, host, cookies, header_params, query_params, body) .await; let mut response = Response::builder(); @@ -1147,9 +1174,21 @@ where }) } +#[derive(validator::Validate)] +#[allow(dead_code)] +struct TestJsonFormDataBodyValidator<'a> { + #[validate(nested)] + body: &'a models::TestJsonFormDataRequest, +} + #[tracing::instrument(skip_all)] -fn test_json_form_data_validation() -> std::result::Result<(), ValidationErrors> { - Ok(()) +fn test_json_form_data_validation( + body: models::TestJsonFormDataRequest, +) -> std::result::Result<(models::TestJsonFormDataRequest,), ValidationErrors> { + let b = TestJsonFormDataBodyValidator { body: &body }; + b.validate()?; + + Ok((body,)) } /// TestJsonFormData - GET /v2/fake/jsonFormData #[tracing::instrument(skip_all)] @@ -1158,17 +1197,18 @@ async fn test_json_form_data( host: Host, cookies: CookieJar, State(api_impl): State, + Form(body): Form, ) -> Result where I: AsRef + Send + Sync, A: Api, { #[allow(clippy::redundant_closure)] - let validation = tokio::task::spawn_blocking(move || test_json_form_data_validation()) + let validation = tokio::task::spawn_blocking(move || test_json_form_data_validation(body)) .await .unwrap(); - let Ok(()) = validation else { + let Ok((body,)) = validation else { return Response::builder() .status(StatusCode::BAD_REQUEST) .body(Body::from(validation.unwrap_err().to_string())) @@ -1177,7 +1217,7 @@ where let result = api_impl .as_ref() - .test_json_form_data(method, host, cookies) + .test_json_form_data(method, host, cookies, body) .await; let mut response = Response::builder(); @@ -1754,13 +1794,31 @@ where }) } +#[derive(validator::Validate)] +#[allow(dead_code)] +struct UpdatePetWithFormBodyValidator<'a> { + #[validate(nested)] + body: &'a models::UpdatePetWithFormRequest, +} + #[tracing::instrument(skip_all)] fn update_pet_with_form_validation( path_params: models::UpdatePetWithFormPathParams, -) -> std::result::Result<(models::UpdatePetWithFormPathParams,), ValidationErrors> { + body: Option, +) -> std::result::Result< + ( + models::UpdatePetWithFormPathParams, + Option, + ), + ValidationErrors, +> { path_params.validate()?; + if let Some(body) = &body { + let b = UpdatePetWithFormBodyValidator { body }; + b.validate()?; + } - Ok((path_params,)) + Ok((path_params, body)) } /// UpdatePetWithForm - POST /v2/pet/{petId} #[tracing::instrument(skip_all)] @@ -1770,6 +1828,7 @@ async fn update_pet_with_form( cookies: CookieJar, Path(path_params): Path, State(api_impl): State, + Form(body): Form>, ) -> Result where I: AsRef + Send + Sync, @@ -1777,11 +1836,11 @@ where { #[allow(clippy::redundant_closure)] let validation = - tokio::task::spawn_blocking(move || update_pet_with_form_validation(path_params)) + tokio::task::spawn_blocking(move || update_pet_with_form_validation(path_params, body)) .await .unwrap(); - let Ok((path_params,)) = validation else { + let Ok((path_params, body)) = validation else { return Response::builder() .status(StatusCode::BAD_REQUEST) .body(Body::from(validation.unwrap_err().to_string())) @@ -1790,7 +1849,7 @@ where let result = api_impl .as_ref() - .update_pet_with_form(method, host, cookies, path_params) + .update_pet_with_form(method, host, cookies, path_params, body) .await; let mut response = Response::builder(); diff --git a/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore/README.md b/samples/server/petstore/rust-axum/output/petstore/README.md index 795a6f427e32..a6f7c5cb19af 100644 --- a/samples/server/petstore/rust-axum/output/petstore/README.md +++ b/samples/server/petstore/rust-axum/output/petstore/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore/src/lib.rs b/samples/server/petstore/rust-axum/output/petstore/src/lib.rs index 50d589234ee9..9cf4c904abaa 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/lib.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/lib.rs @@ -301,6 +301,7 @@ pub trait Api { host: Host, cookies: CookieJar, path_params: models::UpdatePetWithFormPathParams, + body: Option, ) -> Result; /// uploads an image. diff --git a/samples/server/petstore/rust-axum/output/petstore/src/models.rs b/samples/server/petstore/rust-axum/output/petstore/src/models.rs index 3bc961a8430b..b3e7b9da0cba 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/models.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/models.rs @@ -1008,6 +1008,317 @@ impl std::convert::TryFrom for header::IntoHeaderValue { } } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct UpdatePetWithFormRequest { + /// Updated name of the pet + #[serde(rename = "name")] + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + /// Updated status of the pet + #[serde(rename = "status")] + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +impl UpdatePetWithFormRequest { + #[allow(clippy::new_without_default, clippy::too_many_arguments)] + pub fn new() -> UpdatePetWithFormRequest { + UpdatePetWithFormRequest { + name: None, + status: None, + } + } +} + +/// Converts the UpdatePetWithFormRequest value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for UpdatePetWithFormRequest { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let params: Vec> = vec![ + self.name + .as_ref() + .map(|name| ["name".to_string(), name.to_string()].join(",")), + self.status + .as_ref() + .map(|status| ["status".to_string(), status.to_string()].join(",")), + ]; + + write!( + f, + "{}", + params.into_iter().flatten().collect::>().join(",") + ) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a UpdatePetWithFormRequest value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for UpdatePetWithFormRequest { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + /// An intermediate representation of the struct to use for parsing. + #[derive(Default)] + #[allow(dead_code)] + struct IntermediateRep { + pub name: Vec, + pub status: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(','); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => { + return std::result::Result::Err( + "Missing value while parsing UpdatePetWithFormRequest".to_string(), + ) + } + }; + + if let Some(key) = key_result { + #[allow(clippy::match_single_binding)] + match key { + #[allow(clippy::redundant_clone)] + "name" => intermediate_rep.name.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + #[allow(clippy::redundant_clone)] + "status" => intermediate_rep.status.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + _ => { + return std::result::Result::Err( + "Unexpected key while parsing UpdatePetWithFormRequest".to_string(), + ) + } + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(UpdatePetWithFormRequest { + name: intermediate_rep.name.into_iter().next(), + status: intermediate_rep.status.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and HeaderValue + +#[cfg(feature = "server")] +impl std::convert::TryFrom> for HeaderValue { + type Error = String; + + fn try_from( + hdr_value: header::IntoHeaderValue, + ) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Invalid header value for UpdatePetWithFormRequest - value: {} is invalid {}", + hdr_value, e + )), + } + } +} + +#[cfg(feature = "server")] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => { + std::result::Result::Ok(header::IntoHeaderValue(value)) + } + std::result::Result::Err(err) => std::result::Result::Err(format!( + "Unable to convert header value '{}' into UpdatePetWithFormRequest - {}", + value, err + )), + } + } + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Unable to convert header: {:?} to string: {}", + hdr_value, e + )), + } + } +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct UploadFileRequest { + /// Additional data to pass to server + #[serde(rename = "additionalMetadata")] + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_metadata: Option, + + /// file to upload + #[serde(rename = "file")] + #[serde(skip_serializing_if = "Option::is_none")] + pub file: Option, +} + +impl UploadFileRequest { + #[allow(clippy::new_without_default, clippy::too_many_arguments)] + pub fn new() -> UploadFileRequest { + UploadFileRequest { + additional_metadata: None, + file: None, + } + } +} + +/// Converts the UploadFileRequest value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for UploadFileRequest { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let params: Vec> = vec![ + self.additional_metadata + .as_ref() + .map(|additional_metadata| { + [ + "additionalMetadata".to_string(), + additional_metadata.to_string(), + ] + .join(",") + }), + // Skipping file in query parameter serialization + // Skipping file in query parameter serialization + ]; + + write!( + f, + "{}", + params.into_iter().flatten().collect::>().join(",") + ) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a UploadFileRequest value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for UploadFileRequest { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + /// An intermediate representation of the struct to use for parsing. + #[derive(Default)] + #[allow(dead_code)] + struct IntermediateRep { + pub additional_metadata: Vec, + pub file: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(','); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => { + return std::result::Result::Err( + "Missing value while parsing UploadFileRequest".to_string(), + ) + } + }; + + if let Some(key) = key_result { + #[allow(clippy::match_single_binding)] + match key { + #[allow(clippy::redundant_clone)] + "additionalMetadata" => intermediate_rep.additional_metadata.push( + ::from_str(val).map_err(|x| x.to_string())?, + ), + "file" => return std::result::Result::Err( + "Parsing binary data in this style is not supported in UploadFileRequest" + .to_string(), + ), + _ => { + return std::result::Result::Err( + "Unexpected key while parsing UploadFileRequest".to_string(), + ) + } + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(UploadFileRequest { + additional_metadata: intermediate_rep.additional_metadata.into_iter().next(), + file: intermediate_rep.file.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and HeaderValue + +#[cfg(feature = "server")] +impl std::convert::TryFrom> for HeaderValue { + type Error = String; + + fn try_from( + hdr_value: header::IntoHeaderValue, + ) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Invalid header value for UploadFileRequest - value: {} is invalid {}", + hdr_value, e + )), + } + } +} + +#[cfg(feature = "server")] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => { + std::result::Result::Ok(header::IntoHeaderValue(value)) + } + std::result::Result::Err(err) => std::result::Result::Err(format!( + "Unable to convert header value '{}' into UploadFileRequest - {}", + value, err + )), + } + } + std::result::Result::Err(e) => std::result::Result::Err(format!( + "Unable to convert header: {:?} to string: {}", + hdr_value, e + )), + } + } +} + /// A User who is purchasing from the pet store #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] diff --git a/samples/server/petstore/rust-axum/output/petstore/src/server/mod.rs b/samples/server/petstore/rust-axum/output/petstore/src/server/mod.rs index 51fb05bcfa24..2abdd54e9c40 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/server/mod.rs @@ -562,13 +562,31 @@ where }) } +#[derive(validator::Validate)] +#[allow(dead_code)] +struct UpdatePetWithFormBodyValidator<'a> { + #[validate(nested)] + body: &'a models::UpdatePetWithFormRequest, +} + #[tracing::instrument(skip_all)] fn update_pet_with_form_validation( path_params: models::UpdatePetWithFormPathParams, -) -> std::result::Result<(models::UpdatePetWithFormPathParams,), ValidationErrors> { + body: Option, +) -> std::result::Result< + ( + models::UpdatePetWithFormPathParams, + Option, + ), + ValidationErrors, +> { path_params.validate()?; + if let Some(body) = &body { + let b = UpdatePetWithFormBodyValidator { body }; + b.validate()?; + } - Ok((path_params,)) + Ok((path_params, body)) } /// UpdatePetWithForm - POST /v2/pet/{petId} #[tracing::instrument(skip_all)] @@ -578,6 +596,7 @@ async fn update_pet_with_form( cookies: CookieJar, Path(path_params): Path, State(api_impl): State, + Form(body): Form>, ) -> Result where I: AsRef + Send + Sync, @@ -585,11 +604,11 @@ where { #[allow(clippy::redundant_closure)] let validation = - tokio::task::spawn_blocking(move || update_pet_with_form_validation(path_params)) + tokio::task::spawn_blocking(move || update_pet_with_form_validation(path_params, body)) .await .unwrap(); - let Ok((path_params,)) = validation else { + let Ok((path_params, body)) = validation else { return Response::builder() .status(StatusCode::BAD_REQUEST) .body(Body::from(validation.unwrap_err().to_string())) @@ -598,7 +617,7 @@ where let result = api_impl .as_ref() - .update_pet_with_form(method, host, cookies, path_params) + .update_pet_with_form(method, host, cookies, path_params, body) .await; let mut response = Response::builder(); diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md b/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md index 56b88a40475c..49a2490640c4 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.gitignore b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.gitignore new file mode 100644 index 000000000000..a9d37c560c6a --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator-ignore b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/FILES b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/FILES new file mode 100644 index 000000000000..129313d13b57 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/FILES @@ -0,0 +1,9 @@ +.gitignore +.openapi-generator-ignore +Cargo.toml +README.md +src/header.rs +src/lib.rs +src/models.rs +src/server/mod.rs +src/types.rs diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION new file mode 100644 index 000000000000..ecb21862b1ee --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/Cargo.toml b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/Cargo.toml new file mode 100644 index 000000000000..48c393fd4b0a --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/Cargo.toml @@ -0,0 +1,46 @@ +[package] +name = "rust-axum-header-uui" +version = "0.1.9" +authors = ["OpenAPI Generator team and contributors"] +description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" +edition = "2021" + +[features] +default = ["server"] +server = [] +conversion = [ + "frunk", + "frunk_derives", + "frunk_core", + "frunk-enum-core", + "frunk-enum-derive", +] + +[dependencies] +async-trait = "0.1" +axum = { version = "0.7" } +axum-extra = { version = "0.9", features = ["cookie", "multipart"] } +base64 = "0.22" +bytes = "1" +chrono = { version = "0.4", features = ["serde"] } +frunk = { version = "0.4", optional = true } +frunk-enum-core = { version = "0.3", optional = true } +frunk-enum-derive = { version = "0.3", optional = true } +frunk_core = { version = "0.4", optional = true } +frunk_derives = { version = "0.4", optional = true } +http = "1" +lazy_static = "1" +regex = "1" +serde = { version = "1", features = ["derive"] } +serde_json = { version = "1", features = ["raw_value"] } +serde_urlencoded = "0.7" +tokio = { version = "1", default-features = false, features = [ + "signal", + "rt-multi-thread", +] } +tracing = { version = "0.1", features = ["attributes"] } +uuid = { version = "1", features = ["serde"] } +validator = { version = "0.18", features = ["derive"] } + +[dev-dependencies] +tracing-subscriber = "0.3" diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md new file mode 100644 index 000000000000..e99c9e7847f7 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md @@ -0,0 +1,91 @@ +# Rust API for rust-axum-header-uui + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## Overview + +This server was generated by the [openapi-generator] +(https://openapi-generator.tech) project. By using the +[OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote +server, you can easily generate a server stub. + +To see how to make this your own, look here: [README]((https://openapi-generator.tech)) + +- API version: 0.1.9 +- Generator version: 7.6.0-SNAPSHOT + + + +This autogenerated project defines an API crate `rust-axum-header-uui` which contains: +* An `Api` trait defining the API in Rust. +* Data types representing the underlying data model. +* Axum router which accepts HTTP requests and invokes the appropriate `Api` method for each operation. + * Request validations (path, query, body params) are included. + +## Using the generated library + +The generated library has a few optional features that can be activated through Cargo. + +* `server` + * This defaults to enabled and creates the basic skeleton of a server implementation based on Axum. + * To create the server stack you'll need to provide an implementation of the API trait to provide the server function. +* `conversions` + * This defaults to disabled and creates extra derives on models to allow "transmogrification" between objects of structurally similar types. + +See https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section for how to use features in your `Cargo.toml`. + +### Example + +```rust +struct ServerImpl { + // database: sea_orm::DbConn, +} + +#[allow(unused_variables)] +#[async_trait] +impl rust-axum-header-uui::Api for ServerImpl { + // API implementation goes here +} + +pub async fn start_server(addr: &str) { + // initialize tracing + tracing_subscriber::fmt::init(); + + // Init Axum router + let app = rust-axum-header-uui::server::new(Arc::new(ServerImpl)); + + // Add layers to the router + let app = app.layer(...); + + // Run the server with graceful shutdown + let listener = TcpListener::bind(addr).await.unwrap(); + axum::serve(listener, app) + .with_graceful_shutdown(shutdown_signal()) + .await + .unwrap(); +} + +async fn shutdown_signal() { + let ctrl_c = async { + signal::ctrl_c() + .await + .expect("failed to install Ctrl+C handler"); + }; + + #[cfg(unix)] + let terminate = async { + signal::unix::signal(signal::unix::SignalKind::terminate()) + .expect("failed to install signal handler") + .recv() + .await; + }; + + #[cfg(not(unix))] + let terminate = std::future::pending::<()>(); + + tokio::select! { + _ = ctrl_c => {}, + _ = terminate => {}, + } +} +``` diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/header.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/header.rs new file mode 100644 index 000000000000..656550c13244 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/header.rs @@ -0,0 +1,230 @@ +use std::{convert::TryFrom, fmt, ops::Deref, str::FromStr}; + +use chrono::{DateTime, Utc}; +use http::HeaderValue; + +/// A struct to allow homogeneous conversion into a HeaderValue. We can't +/// implement the From/Into trait on HeaderValue because we don't own +/// either of the types. +#[derive(Debug, Clone)] +pub(crate) struct IntoHeaderValue(pub T); + +// Generic implementations + +impl Deref for IntoHeaderValue { + type Target = T; + + fn deref(&self) -> &T { + &self.0 + } +} + +// Derive for each TryFrom in http::HeaderValue + +macro_rules! ihv_generate { + ($t:ident) => { + impl TryFrom for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!( + "Unable to parse {} as a string: {}", + stringify!($t), + e + )), + }, + Err(e) => Err(format!( + "Unable to parse header {:?} as a string - {}", + hdr_value, e + )), + } + } + } + + impl TryFrom> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result { + Ok(hdr_value.0.into()) + } + } + }; +} + +ihv_generate!(u64); +ihv_generate!(i64); +ihv_generate!(i16); +ihv_generate!(u16); +ihv_generate!(u32); +ihv_generate!(usize); +ihv_generate!(isize); +ihv_generate!(i32); + +// Custom derivations + +// Vec + +impl TryFrom for IntoHeaderValue> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value + .split(',') + .filter_map(|x| match x.trim() { + "" => None, + y => Some(y.to_string()), + }) + .collect(), + )), + Err(e) => Err(format!( + "Unable to parse header: {:?} as a string - {}", + hdr_value, e + )), + } + } +} + +impl TryFrom>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue>) -> Result { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!( + "Unable to convert {:?} into a header - {}", + hdr_value, e + )), + } + } +} + +// String + +impl TryFrom for IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", hdr_value, e)), + } + } +} + +impl TryFrom> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue) -> Result { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!( + "Unable to convert {:?} from a header {}", + hdr_value, e + )), + } + } +} + +// Bool + +impl TryFrom for IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", hdr_value, e)), + }, + Err(e) => Err(format!( + "Unable to convert {:?} from a header {}", + hdr_value, e + )), + } + } +} + +impl TryFrom> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue) -> Result { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!( + "Unable to convert: {:?} into a header: {}", + hdr_value, e + )), + } + } +} + +// DateTime + +impl TryFrom for IntoHeaderValue> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", 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_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!( + "Unable to convert {:?} to a header: {}", + hdr_value, e + )), + } + } +} + +// 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 + )), + } + } +} diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/lib.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/lib.rs new file mode 100644 index 000000000000..cc68ed2682b2 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/lib.rs @@ -0,0 +1,58 @@ +#![allow( + missing_docs, + trivial_casts, + unused_variables, + unused_mut, + unused_extern_crates, + non_camel_case_types, + unused_imports, + unused_attributes +)] +#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)] + +use async_trait::async_trait; +use axum::extract::*; +use axum_extra::extract::{CookieJar, Multipart}; +use bytes::Bytes; +use http::Method; +use serde::{Deserialize, Serialize}; + +use types::*; + +pub const BASE_PATH: &str = ""; +pub const API_VERSION: &str = "0.1.9"; + + #[derive(Debug, PartialEq, Serialize, Deserialize)] +#[must_use] +#[allow(clippy::large_enum_variant)] +pub enum UsersPostResponse { + /// Added row to table! + Status201_AddedRowToTable + (String) +} + + +/// API +#[async_trait] +#[allow(clippy::ptr_arg)] +pub trait Api { + + /// UsersPost - POST /users + async fn users_post( + &self, + method: Method, + host: Host, + cookies: CookieJar, + header_params: models::UsersPostHeaderParams, + ) -> Result; + +} + +#[cfg(feature = "server")] +pub mod server; + +pub mod models; +pub mod types; + +#[cfg(feature = "server")] +pub(crate) mod header; diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/models.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/models.rs new file mode 100644 index 000000000000..22862b9b8b37 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/models.rs @@ -0,0 +1,49 @@ +#![allow(unused_qualifications)] + +use http::HeaderValue; +use validator::Validate; + +#[cfg(feature = "server")] +use crate::header; +use crate::{models, types::*}; + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct UsersPostHeaderParams { + pub some_uid: uuid::Uuid, +} + +#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct HeaderUuid(uuid::Uuid); + +impl validator::Validate for HeaderUuid { + fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> { + std::result::Result::Ok(()) + } +} + +impl std::convert::From for HeaderUuid { + fn from(x: uuid::Uuid) -> Self { + HeaderUuid(x) + } +} + +impl std::convert::From for uuid::Uuid { + fn from(x: HeaderUuid) -> Self { + x.0 + } +} + +impl std::ops::Deref for HeaderUuid { + type Target = uuid::Uuid; + fn deref(&self) -> &uuid::Uuid { + &self.0 + } +} + +impl std::ops::DerefMut for HeaderUuid { + fn deref_mut(&mut self) -> &mut uuid::Uuid { + &mut self.0 + } +} diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/server/mod.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/server/mod.rs new file mode 100644 index 000000000000..2a0fa5663243 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/server/mod.rs @@ -0,0 +1,139 @@ +use std::collections::HashMap; + +use axum::{body::Body, extract::*, response::Response, routing::*}; +use axum_extra::extract::{CookieJar, Multipart}; +use bytes::Bytes; +use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode}; +use tracing::error; +use validator::{Validate, ValidationErrors}; + +use crate::{header, types::*}; + +#[allow(unused_imports)] +use crate::models; + +use crate::{Api, UsersPostResponse}; + +/// Setup API Server. +pub fn new(api_impl: I) -> Router +where + I: AsRef + Clone + Send + Sync + 'static, + A: Api + 'static, +{ + // build our application with a route + Router::new() + .route("/users", post(users_post::)) + .with_state(api_impl) +} + +#[tracing::instrument(skip_all)] +fn users_post_validation( + header_params: models::UsersPostHeaderParams, +) -> std::result::Result<(models::UsersPostHeaderParams,), ValidationErrors> { + header_params.validate()?; + + Ok((header_params,)) +} +/// UsersPost - POST /users +#[tracing::instrument(skip_all)] +async fn users_post( + method: Method, + host: Host, + cookies: CookieJar, + headers: HeaderMap, + State(api_impl): State, +) -> Result +where + I: AsRef + Send + Sync, + A: Api, +{ + // Header parameters + let header_params = { + let header_some_uid = headers.get(HeaderName::from_static("some_uid")); + + let header_some_uid = match header_some_uid { + Some(v) => match header::IntoHeaderValue::::try_from((*v).clone()) { + Ok(result) => result.0, + Err(err) => { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(format!("Invalid header some_uid - {}", err))) + .map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }); + } + }, + None => { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from("Missing required header some_uid")) + .map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }); + } + }; + + models::UsersPostHeaderParams { + some_uid: header_some_uid, + } + }; + + #[allow(clippy::redundant_closure)] + let validation = tokio::task::spawn_blocking(move || users_post_validation(header_params)) + .await + .unwrap(); + + let Ok((header_params,)) = validation else { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(validation.unwrap_err().to_string())) + .map_err(|_| StatusCode::BAD_REQUEST); + }; + + let result = api_impl + .as_ref() + .users_post(method, host, cookies, header_params) + .await; + + let mut response = Response::builder(); + + let resp = match result { + Ok(rsp) => match rsp { + UsersPostResponse::Status201_AddedRowToTable(body) => { + let mut response = response.status(201); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers.insert( + CONTENT_TYPE, + HeaderValue::from_str("application/json").map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + })?, + ); + } + + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + response.status(500).body(Body::empty()) + } + }; + + resp.map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) +} diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/types.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/types.rs new file mode 100644 index 000000000000..aac11a86f4d6 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/types.rs @@ -0,0 +1,665 @@ +use std::{mem, str::FromStr}; + +use base64::{engine::general_purpose, Engine}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[allow(dead_code)] +pub struct Object(serde_json::Value); + +impl validator::Validate for Object { + fn validate(&self) -> Result<(), validator::ValidationErrors> { + Ok(()) + } +} + +impl FromStr for Object { + type Err = String; + + fn from_str(s: &str) -> Result { + Ok(Self(serde_json::Value::String(s.to_owned()))) + } +} + +/// Serde helper function to create a default `Option>` while +/// deserializing +pub fn default_optional_nullable() -> Option> { + None +} + +/// Serde helper function to deserialize into an `Option>` +pub fn deserialize_optional_nullable<'de, D, T>( + deserializer: D, +) -> Result>, D::Error> +where + D: Deserializer<'de>, + T: Deserialize<'de>, +{ + Option::::deserialize(deserializer).map(|val| match val { + Some(inner) => Some(Nullable::Present(inner)), + None => Some(Nullable::Null), + }) +} + +/// The Nullable type. Represents a value which may be specified as null on an API. +/// Note that this is distinct from a value that is optional and not present! +/// +/// Nullable implements many of the same methods as the Option type (map, unwrap, etc). +#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] +pub enum Nullable { + /// Null value + Null, + /// Value is present + Present(T), +} + +impl Nullable { + ///////////////////////////////////////////////////////////////////////// + // Querying the contained values + ///////////////////////////////////////////////////////////////////////// + + /// Returns `true` if the Nullable is a `Present` value. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x: Nullable = Nullable::Present(2); + /// assert_eq!(x.is_present(), true); + /// + /// let x: Nullable = Nullable::Null; + /// assert_eq!(x.is_present(), false); + /// ``` + #[inline] + pub fn is_present(&self) -> bool { + match *self { + Nullable::Present(_) => true, + Nullable::Null => false, + } + } + + /// Returns `true` if the Nullable is a `Null` value. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x: Nullable = Nullable::Present(2); + /// assert_eq!(x.is_null(), false); + /// + /// let x: Nullable = Nullable::Null; + /// assert_eq!(x.is_null(), true); + /// ``` + #[inline] + pub fn is_null(&self) -> bool { + !self.is_present() + } + + ///////////////////////////////////////////////////////////////////////// + // Adapter for working with references + ///////////////////////////////////////////////////////////////////////// + + /// Converts from `Nullable` to `Nullable<&T>`. + /// + /// # Examples + /// + /// Convert an `Nullable<`[`String`]`>` into a `Nullable<`[`usize`]`>`, preserving the original. + /// The [`map`] method takes the `self` argument by value, consuming the original, + /// so this technique uses `as_ref` to first take a `Nullable` to a reference + /// to the value inside the original. + /// + /// [`map`]: enum.Nullable.html#method.map + /// [`String`]: ../../std/string/struct.String.html + /// [`usize`]: ../../std/primitive.usize.html + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let num_as_str: Nullable = Nullable::Present("10".to_string()); + /// // First, cast `Nullable` to `Nullable<&String>` with `as_ref`, + /// // then consume *that* with `map`, leaving `num_as_str` on the stack. + /// let num_as_int: Nullable = num_as_str.as_ref().map(|n| n.len()); + /// println!("still can print num_as_str: {:?}", num_as_str); + /// ``` + #[inline] + pub fn as_ref(&self) -> Nullable<&T> { + match *self { + Nullable::Present(ref x) => Nullable::Present(x), + Nullable::Null => Nullable::Null, + } + } + + /// Converts from `Nullable` to `Nullable<&mut T>`. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let mut x = Nullable::Present(2); + /// match x.as_mut() { + /// Nullable::Present(v) => *v = 42, + /// Nullable::Null => {}, + /// } + /// assert_eq!(x, Nullable::Present(42)); + /// ``` + #[inline] + pub fn as_mut(&mut self) -> Nullable<&mut T> { + match *self { + Nullable::Present(ref mut x) => Nullable::Present(x), + Nullable::Null => Nullable::Null, + } + } + + ///////////////////////////////////////////////////////////////////////// + // Getting to contained values + ///////////////////////////////////////////////////////////////////////// + + /// Unwraps a Nullable, yielding the content of a `Nullable::Present`. + /// + /// # Panics + /// + /// Panics if the value is a [`Nullable::Null`] with a custom panic message provided by + /// `msg`. + /// + /// [`Nullable::Null`]: #variant.Null + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = Nullable::Present("value"); + /// assert_eq!(x.expect("the world is ending"), "value"); + /// ``` + /// + /// ```{.should_panic} + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x: Nullable<&str> = Nullable::Null; + /// x.expect("the world is ending"); // panics with `the world is ending` + /// ``` + #[inline] + pub fn expect(self, msg: &str) -> T { + match self { + Nullable::Present(val) => val, + Nullable::Null => expect_failed(msg), + } + } + + /// Moves the value `v` out of the `Nullable` if it is `Nullable::Present(v)`. + /// + /// In general, because this function may panic, its use is discouraged. + /// Instead, prefer to use pattern matching and handle the `Nullable::Null` + /// case explicitly. + /// + /// # Panics + /// + /// Panics if the self value equals [`Nullable::Null`]. + /// + /// [`Nullable::Null`]: #variant.Null + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = Nullable::Present("air"); + /// assert_eq!(x.unwrap(), "air"); + /// ``` + /// + /// ```{.should_panic} + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.unwrap(), "air"); // fails + /// ``` + #[inline] + pub fn unwrap(self) -> T { + match self { + Nullable::Present(val) => val, + Nullable::Null => panic!("called `Nullable::unwrap()` on a `Nullable::Null` value"), + } + } + + /// Returns the contained value or a default. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// assert_eq!(Nullable::Present("car").unwrap_or("bike"), "car"); + /// assert_eq!(Nullable::Null.unwrap_or("bike"), "bike"); + /// ``` + #[inline] + pub fn unwrap_or(self, def: T) -> T { + match self { + Nullable::Present(x) => x, + Nullable::Null => def, + } + } + + /// Returns the contained value or computes it from a closure. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let k = 10; + /// assert_eq!(Nullable::Present(4).unwrap_or_else(|| 2 * k), 4); + /// assert_eq!(Nullable::Null.unwrap_or_else(|| 2 * k), 20); + /// ``` + #[inline] + pub fn unwrap_or_else T>(self, f: F) -> T { + match self { + Nullable::Present(x) => x, + Nullable::Null => f(), + } + } + + ///////////////////////////////////////////////////////////////////////// + // Transforming contained values + ///////////////////////////////////////////////////////////////////////// + + /// Maps a `Nullable` to `Nullable` by applying a function to a contained value. + /// + /// # Examples + /// + /// Convert a `Nullable<`[`String`]`>` into a `Nullable<`[`usize`]`>`, consuming the original: + /// + /// [`String`]: ../../std/string/struct.String.html + /// [`usize`]: ../../std/primitive.usize.html + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let maybe_some_string = Nullable::Present(String::from("Hello, World!")); + /// // `Nullable::map` takes self *by value*, consuming `maybe_some_string` + /// let maybe_some_len = maybe_some_string.map(|s| s.len()); + /// + /// assert_eq!(maybe_some_len, Nullable::Present(13)); + /// ``` + #[inline] + pub fn map U>(self, f: F) -> Nullable { + match self { + Nullable::Present(x) => Nullable::Present(f(x)), + Nullable::Null => Nullable::Null, + } + } + + /// Applies a function to the contained value (if any), + /// or returns a `default` (if not). + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = Nullable::Present("foo"); + /// assert_eq!(x.map_or(42, |v| v.len()), 3); + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.map_or(42, |v| v.len()), 42); + /// ``` + #[inline] + pub fn map_or U>(self, default: U, f: F) -> U { + match self { + Nullable::Present(t) => f(t), + Nullable::Null => default, + } + } + + /// Applies a function to the contained value (if any), + /// or computes a `default` (if not). + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let k = 21; + /// + /// let x = Nullable::Present("foo"); + /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 3); + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42); + /// ``` + #[inline] + pub fn map_or_else U, F: FnOnce(T) -> U>(self, default: D, f: F) -> U { + match self { + Nullable::Present(t) => f(t), + Nullable::Null => default(), + } + } + + /// Transforms the `Nullable` into a [`Result`], mapping `Nullable::Present(v)` to + /// [`Ok(v)`] and `Nullable::Null` to [`Err(err)`][Err]. + /// + /// [`Result`]: ../../std/result/enum.Result.html + /// [`Ok(v)`]: ../../std/result/enum.Result.html#variant.Ok + /// [Err]: ../../std/result/enum.Result.html#variant.Err + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = Nullable::Present("foo"); + /// assert_eq!(x.ok_or(0), Ok("foo")); + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.ok_or(0), Err(0)); + /// ``` + #[inline] + pub fn ok_or(self, err: E) -> Result { + match self { + Nullable::Present(v) => Ok(v), + Nullable::Null => Err(err), + } + } + + /// Transforms the `Nullable` into a [`Result`], mapping `Nullable::Present(v)` to + /// [`Ok(v)`] and `Nullable::Null` to [`Err(err())`][Err]. + /// + /// [`Result`]: ../../std/result/enum.Result.html + /// [`Ok(v)`]: ../../std/result/enum.Result.html#variant.Ok + /// [Err]: ../../std/result/enum.Result.html#variant.Err + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = Nullable::Present("foo"); + /// assert_eq!(x.ok_or_else(|| 0), Ok("foo")); + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.ok_or_else(|| 0), Err(0)); + /// ``` + #[inline] + pub fn ok_or_else E>(self, err: F) -> Result { + match self { + Nullable::Present(v) => Ok(v), + Nullable::Null => Err(err()), + } + } + + ///////////////////////////////////////////////////////////////////////// + // Boolean operations on the values, eager and lazy + ///////////////////////////////////////////////////////////////////////// + + /// Returns `Nullable::Null` if the Nullable is `Nullable::Null`, otherwise returns `optb`. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = Nullable::Present(2); + /// let y: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.and(y), Nullable::Null); + /// + /// let x: Nullable = Nullable::Null; + /// let y = Nullable::Present("foo"); + /// assert_eq!(x.and(y), Nullable::Null); + /// + /// let x = Nullable::Present(2); + /// let y = Nullable::Present("foo"); + /// assert_eq!(x.and(y), Nullable::Present("foo")); + /// + /// let x: Nullable = Nullable::Null; + /// let y: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.and(y), Nullable::Null); + /// ``` + #[inline] + pub fn and(self, optb: Nullable) -> Nullable { + match self { + Nullable::Present(_) => optb, + Nullable::Null => Nullable::Null, + } + } + + /// Returns `Nullable::Null` if the Nullable is `Nullable::Null`, otherwise calls `f` with the + /// wrapped value and returns the result. + /// + /// Some languages call this operation flatmap. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// fn sq(x: u32) -> Nullable { Nullable::Present(x * x) } + /// fn nope(_: u32) -> Nullable { Nullable::Null } + /// + /// assert_eq!(Nullable::Present(2).and_then(sq).and_then(sq), Nullable::Present(16)); + /// assert_eq!(Nullable::Present(2).and_then(sq).and_then(nope), Nullable::Null); + /// assert_eq!(Nullable::Present(2).and_then(nope).and_then(sq), Nullable::Null); + /// assert_eq!(Nullable::Null.and_then(sq).and_then(sq), Nullable::Null); + /// ``` + #[inline] + pub fn and_then Nullable>(self, f: F) -> Nullable { + match self { + Nullable::Present(x) => f(x), + Nullable::Null => Nullable::Null, + } + } + + /// Returns the Nullable if it contains a value, otherwise returns `optb`. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = Nullable::Present(2); + /// let y = Nullable::Null; + /// assert_eq!(x.or(y), Nullable::Present(2)); + /// + /// let x = Nullable::Null; + /// let y = Nullable::Present(100); + /// assert_eq!(x.or(y), Nullable::Present(100)); + /// + /// let x = Nullable::Present(2); + /// let y = Nullable::Present(100); + /// assert_eq!(x.or(y), Nullable::Present(2)); + /// + /// let x: Nullable = Nullable::Null; + /// let y = Nullable::Null; + /// assert_eq!(x.or(y), Nullable::Null); + /// ``` + #[inline] + pub fn or(self, optb: Nullable) -> Nullable { + match self { + Nullable::Present(_) => self, + Nullable::Null => optb, + } + } + + /// Returns the Nullable if it contains a value, otherwise calls `f` and + /// returns the result. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// fn nobody() -> Nullable<&'static str> { Nullable::Null } + /// fn vikings() -> Nullable<&'static str> { Nullable::Present("vikings") } + /// + /// assert_eq!(Nullable::Present("barbarians").or_else(vikings), + /// Nullable::Present("barbarians")); + /// assert_eq!(Nullable::Null.or_else(vikings), Nullable::Present("vikings")); + /// assert_eq!(Nullable::Null.or_else(nobody), Nullable::Null); + /// ``` + #[inline] + pub fn or_else Nullable>(self, f: F) -> Nullable { + match self { + Nullable::Present(_) => self, + Nullable::Null => f(), + } + } + + ///////////////////////////////////////////////////////////////////////// + // Misc + ///////////////////////////////////////////////////////////////////////// + + /// Takes the value out of the Nullable, leaving a `Nullable::Null` in its place. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let mut x = Nullable::Present(2); + /// x.take(); + /// assert_eq!(x, Nullable::Null); + /// + /// let mut x: Nullable = Nullable::Null; + /// x.take(); + /// assert_eq!(x, Nullable::Null); + /// ``` + #[inline] + pub fn take(&mut self) -> Nullable { + mem::replace(self, Nullable::Null) + } +} + +impl<'a, T: Clone> Nullable<&'a T> { + /// Maps an `Nullable<&T>` to an `Nullable` by cloning the contents of the + /// Nullable. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = 12; + /// let opt_x = Nullable::Present(&x); + /// assert_eq!(opt_x, Nullable::Present(&12)); + /// let cloned = opt_x.cloned(); + /// assert_eq!(cloned, Nullable::Present(12)); + /// ``` + pub fn cloned(self) -> Nullable { + self.map(Clone::clone) + } +} + +impl Nullable { + /// Returns the contained value or a default + /// + /// Consumes the `self` argument then, if `Nullable::Present`, returns the contained + /// value, otherwise if `Nullable::Null`, returns the default value for that + /// type. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_header_uui::types::Nullable; + /// + /// let x = Nullable::Present(42); + /// assert_eq!(42, x.unwrap_or_default()); + /// + /// let y: Nullable = Nullable::Null; + /// assert_eq!(0, y.unwrap_or_default()); + /// ``` + #[inline] + pub fn unwrap_or_default(self) -> T { + match self { + Nullable::Present(x) => x, + Nullable::Null => Default::default(), + } + } +} + +impl Default for Nullable { + /// Returns None. + #[inline] + fn default() -> Nullable { + Nullable::Null + } +} + +impl From for Nullable { + fn from(val: T) -> Nullable { + Nullable::Present(val) + } +} + +impl Serialize for Nullable +where + T: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + Nullable::Present(ref inner) => serializer.serialize_some(&inner), + Nullable::Null => serializer.serialize_none(), + } + } +} + +impl<'de, T> Deserialize<'de> for Nullable +where + T: serde::de::DeserializeOwned, +{ + fn deserialize(deserializer: D) -> Result, D::Error> + where + D: Deserializer<'de>, + { + // In order to deserialize a required, but nullable, value, we first have to check whether + // the value is present at all. To do this, we deserialize to a serde_json::Value, which + // fails if the value is missing, or gives serde_json::Value::Null if the value is present. + // If that succeeds as null, we can easily return a Null. + // If that succeeds as some value, we deserialize that value and return a Present. + // If that errors, we return the error. + let presence: Result<::serde_json::Value, _> = + serde::Deserialize::deserialize(deserializer); + match presence { + Ok(serde_json::Value::Null) => Ok(Nullable::Null), + Ok(some_value) => serde_json::from_value(some_value) + .map(Nullable::Present) + .map_err(serde::de::Error::custom), + Err(x) => Err(x), + } + } +} + +#[inline(never)] +#[cold] +fn expect_failed(msg: &str) -> ! { + panic!("{}", msg) +} + +#[derive(Debug, Clone, PartialEq, PartialOrd)] +/// Base64-encoded byte array +pub struct ByteArray(pub Vec); + +impl Serialize for ByteArray { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(&general_purpose::STANDARD.encode(&self.0)) + } +} + +impl<'de> Deserialize<'de> for ByteArray { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match general_purpose::STANDARD.decode(s) { + Ok(bin) => Ok(ByteArray(bin)), + _ => Err(serde::de::Error::custom("invalid base64")), + } + } +} diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION index 08bfd0643b8c..ecb21862b1ee 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-test/README.md index d1f027f128d6..615ce4f4c740 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 2.3.4 -- Generator version: 7.5.0-SNAPSHOT +- Generator version: 7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.gitignore b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.gitignore new file mode 100644 index 000000000000..a9d37c560c6a --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator-ignore b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/FILES b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/FILES new file mode 100644 index 000000000000..ea1c5b8c5beb --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/FILES @@ -0,0 +1,8 @@ +.gitignore +Cargo.toml +README.md +src/header.rs +src/lib.rs +src/models.rs +src/server/mod.rs +src/types.rs diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION new file mode 100644 index 000000000000..ecb21862b1ee --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.6.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/Cargo.toml b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/Cargo.toml new file mode 100644 index 000000000000..a98003aa1175 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/Cargo.toml @@ -0,0 +1,46 @@ +[package] +name = "rust-axum-validation-test" +version = "0.0.1" +authors = ["OpenAPI Generator team and contributors"] +description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" +edition = "2021" + +[features] +default = ["server"] +server = [] +conversion = [ + "frunk", + "frunk_derives", + "frunk_core", + "frunk-enum-core", + "frunk-enum-derive", +] + +[dependencies] +async-trait = "0.1" +axum = { version = "0.7" } +axum-extra = { version = "0.9", features = ["cookie", "multipart"] } +base64 = "0.22" +bytes = "1" +chrono = { version = "0.4", features = ["serde"] } +frunk = { version = "0.4", optional = true } +frunk-enum-core = { version = "0.3", optional = true } +frunk-enum-derive = { version = "0.3", optional = true } +frunk_core = { version = "0.4", optional = true } +frunk_derives = { version = "0.4", optional = true } +http = "1" +lazy_static = "1" +regex = "1" +serde = { version = "1", features = ["derive"] } +serde_json = { version = "1", features = ["raw_value"] } +serde_urlencoded = "0.7" +tokio = { version = "1", default-features = false, features = [ + "signal", + "rt-multi-thread", +] } +tracing = { version = "0.1", features = ["attributes"] } +uuid = { version = "1", features = ["serde"] } +validator = { version = "0.18", features = ["derive"] } + +[dev-dependencies] +tracing-subscriber = "0.3" diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md new file mode 100644 index 000000000000..a017ed146e0f --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md @@ -0,0 +1,91 @@ +# Rust API for rust-axum-validation-test + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## Overview + +This server was generated by the [openapi-generator] +(https://openapi-generator.tech) project. By using the +[OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote +server, you can easily generate a server stub. + +To see how to make this your own, look here: [README]((https://openapi-generator.tech)) + +- API version: 0.0.1 +- Generator version: 7.6.0-SNAPSHOT + + + +This autogenerated project defines an API crate `rust-axum-validation-test` which contains: +* An `Api` trait defining the API in Rust. +* Data types representing the underlying data model. +* Axum router which accepts HTTP requests and invokes the appropriate `Api` method for each operation. + * Request validations (path, query, body params) are included. + +## Using the generated library + +The generated library has a few optional features that can be activated through Cargo. + +* `server` + * This defaults to enabled and creates the basic skeleton of a server implementation based on Axum. + * To create the server stack you'll need to provide an implementation of the API trait to provide the server function. +* `conversions` + * This defaults to disabled and creates extra derives on models to allow "transmogrification" between objects of structurally similar types. + +See https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section for how to use features in your `Cargo.toml`. + +### Example + +```rust +struct ServerImpl { + // database: sea_orm::DbConn, +} + +#[allow(unused_variables)] +#[async_trait] +impl rust-axum-validation-test::Api for ServerImpl { + // API implementation goes here +} + +pub async fn start_server(addr: &str) { + // initialize tracing + tracing_subscriber::fmt::init(); + + // Init Axum router + let app = rust-axum-validation-test::server::new(Arc::new(ServerImpl)); + + // Add layers to the router + let app = app.layer(...); + + // Run the server with graceful shutdown + let listener = TcpListener::bind(addr).await.unwrap(); + axum::serve(listener, app) + .with_graceful_shutdown(shutdown_signal()) + .await + .unwrap(); +} + +async fn shutdown_signal() { + let ctrl_c = async { + signal::ctrl_c() + .await + .expect("failed to install Ctrl+C handler"); + }; + + #[cfg(unix)] + let terminate = async { + signal::unix::signal(signal::unix::SignalKind::terminate()) + .expect("failed to install signal handler") + .recv() + .await; + }; + + #[cfg(not(unix))] + let terminate = std::future::pending::<()>(); + + tokio::select! { + _ = ctrl_c => {}, + _ = terminate => {}, + } +} +``` diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/header.rs b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/header.rs new file mode 100644 index 000000000000..7c530892fbf2 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/header.rs @@ -0,0 +1,197 @@ +use std::{convert::TryFrom, fmt, ops::Deref}; + +use chrono::{DateTime, Utc}; +use http::HeaderValue; + +/// A struct to allow homogeneous conversion into a HeaderValue. We can't +/// implement the From/Into trait on HeaderValue because we don't own +/// either of the types. +#[derive(Debug, Clone)] +pub(crate) struct IntoHeaderValue(pub T); + +// Generic implementations + +impl Deref for IntoHeaderValue { + type Target = T; + + fn deref(&self) -> &T { + &self.0 + } +} + +// Derive for each TryFrom in http::HeaderValue + +macro_rules! ihv_generate { + ($t:ident) => { + impl TryFrom for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!( + "Unable to parse {} as a string: {}", + stringify!($t), + e + )), + }, + Err(e) => Err(format!( + "Unable to parse header {:?} as a string - {}", + hdr_value, e + )), + } + } + } + + impl TryFrom> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result { + Ok(hdr_value.0.into()) + } + } + }; +} + +ihv_generate!(u64); +ihv_generate!(i64); +ihv_generate!(i16); +ihv_generate!(u16); +ihv_generate!(u32); +ihv_generate!(usize); +ihv_generate!(isize); +ihv_generate!(i32); + +// Custom derivations + +// Vec + +impl TryFrom for IntoHeaderValue> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value + .split(',') + .filter_map(|x| match x.trim() { + "" => None, + y => Some(y.to_string()), + }) + .collect(), + )), + Err(e) => Err(format!( + "Unable to parse header: {:?} as a string - {}", + hdr_value, e + )), + } + } +} + +impl TryFrom>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue>) -> Result { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!( + "Unable to convert {:?} into a header - {}", + hdr_value, e + )), + } + } +} + +// String + +impl TryFrom for IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", hdr_value, e)), + } + } +} + +impl TryFrom> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue) -> Result { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!( + "Unable to convert {:?} from a header {}", + hdr_value, e + )), + } + } +} + +// Bool + +impl TryFrom for IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", hdr_value, e)), + }, + Err(e) => Err(format!( + "Unable to convert {:?} from a header {}", + hdr_value, e + )), + } + } +} + +impl TryFrom> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue) -> Result { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!( + "Unable to convert: {:?} into a header: {}", + hdr_value, e + )), + } + } +} + +// DateTime + +impl TryFrom for IntoHeaderValue> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", 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_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!( + "Unable to convert {:?} to a header: {}", + hdr_value, e + )), + } + } +} diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/lib.rs b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/lib.rs new file mode 100644 index 000000000000..f66c98cbf624 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/lib.rs @@ -0,0 +1,54 @@ +#![allow( + missing_docs, + trivial_casts, + unused_variables, + unused_mut, + unused_extern_crates, + non_camel_case_types, + unused_imports, + unused_attributes +)] +#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)] + +use async_trait::async_trait; +use axum::extract::*; +use axum_extra::extract::{CookieJar, Multipart}; +use bytes::Bytes; +use http::Method; +use serde::{Deserialize, Serialize}; + +use types::*; + +pub const BASE_PATH: &str = ""; +pub const API_VERSION: &str = "0.0.1"; + +#[derive(Debug, PartialEq, Serialize, Deserialize)] +#[must_use] +#[allow(clippy::large_enum_variant)] +pub enum MailPutResponse { + /// OK. + Status204_OK, +} + +/// API +#[async_trait] +#[allow(clippy::ptr_arg)] +pub trait Api { + /// MailPut - PUT /mail + async fn mail_put( + &self, + method: Method, + host: Host, + cookies: CookieJar, + body: models::Email, + ) -> Result; +} + +#[cfg(feature = "server")] +pub mod server; + +pub mod models; +pub mod types; + +#[cfg(feature = "server")] +pub(crate) mod header; diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/models.rs b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/models.rs new file mode 100644 index 000000000000..5f38b9e1c5d3 --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/models.rs @@ -0,0 +1,56 @@ +#![allow(unused_qualifications)] + +use http::HeaderValue; +use validator::Validate; + +#[cfg(feature = "server")] +use crate::header; +use crate::{models, types::*}; + +#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct Email(String); + +impl validator::Validate for Email { + fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> { + std::result::Result::Ok(()) + } +} + +impl std::convert::From for Email { + fn from(x: String) -> Self { + Email(x) + } +} + +impl std::fmt::Display for Email { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self.0) + } +} + +impl std::str::FromStr for Email { + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(Email(x.to_string())) + } +} + +impl std::convert::From for String { + fn from(x: Email) -> Self { + x.0 + } +} + +impl std::ops::Deref for Email { + type Target = String; + fn deref(&self) -> &String { + &self.0 + } +} + +impl std::ops::DerefMut for Email { + fn deref_mut(&mut self) -> &mut String { + &mut self.0 + } +} diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/server/mod.rs b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/server/mod.rs new file mode 100644 index 000000000000..98533a86b73d --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/server/mod.rs @@ -0,0 +1,67 @@ +use std::collections::HashMap; + +use axum::{body::Body, extract::*, response::Response, routing::*}; +use axum_extra::extract::{CookieJar, Multipart}; +use bytes::Bytes; +use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode}; +use tracing::error; +use validator::{Validate, ValidationErrors}; + +use crate::{header, types::*}; + +#[allow(unused_imports)] +use crate::models; + +use crate::{Api, MailPutResponse}; + +/// Setup API Server. +pub fn new(api_impl: I) -> Router +where + I: AsRef + Clone + Send + Sync + 'static, + A: Api + 'static, +{ + // build our application with a route + Router::new() + .route("/mail", put(mail_put::)) + .with_state(api_impl) +} + +/// MailPut - PUT /mail +#[tracing::instrument(skip_all)] +async fn mail_put( + method: Method, + host: Host, + cookies: CookieJar, + State(api_impl): State, + Json(body): Json, +) -> Result +where + I: AsRef + Send + Sync, + A: Api, +{ + let result = api_impl + .as_ref() + .mail_put(method, host, cookies, body) + .await; + + let mut response = Response::builder(); + + let resp = match result { + Ok(rsp) => match rsp { + MailPutResponse::Status204_OK => { + let mut response = response.status(204); + response.body(Body::empty()) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + response.status(500).body(Body::empty()) + } + }; + + resp.map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) +} diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/types.rs b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/types.rs new file mode 100644 index 000000000000..7f2bc396ccfd --- /dev/null +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/types.rs @@ -0,0 +1,665 @@ +use std::{mem, str::FromStr}; + +use base64::{engine::general_purpose, Engine}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[allow(dead_code)] +pub struct Object(serde_json::Value); + +impl validator::Validate for Object { + fn validate(&self) -> Result<(), validator::ValidationErrors> { + Ok(()) + } +} + +impl FromStr for Object { + type Err = String; + + fn from_str(s: &str) -> Result { + Ok(Self(serde_json::Value::String(s.to_owned()))) + } +} + +/// Serde helper function to create a default `Option>` while +/// deserializing +pub fn default_optional_nullable() -> Option> { + None +} + +/// Serde helper function to deserialize into an `Option>` +pub fn deserialize_optional_nullable<'de, D, T>( + deserializer: D, +) -> Result>, D::Error> +where + D: Deserializer<'de>, + T: Deserialize<'de>, +{ + Option::::deserialize(deserializer).map(|val| match val { + Some(inner) => Some(Nullable::Present(inner)), + None => Some(Nullable::Null), + }) +} + +/// The Nullable type. Represents a value which may be specified as null on an API. +/// Note that this is distinct from a value that is optional and not present! +/// +/// Nullable implements many of the same methods as the Option type (map, unwrap, etc). +#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] +pub enum Nullable { + /// Null value + Null, + /// Value is present + Present(T), +} + +impl Nullable { + ///////////////////////////////////////////////////////////////////////// + // Querying the contained values + ///////////////////////////////////////////////////////////////////////// + + /// Returns `true` if the Nullable is a `Present` value. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x: Nullable = Nullable::Present(2); + /// assert_eq!(x.is_present(), true); + /// + /// let x: Nullable = Nullable::Null; + /// assert_eq!(x.is_present(), false); + /// ``` + #[inline] + pub fn is_present(&self) -> bool { + match *self { + Nullable::Present(_) => true, + Nullable::Null => false, + } + } + + /// Returns `true` if the Nullable is a `Null` value. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x: Nullable = Nullable::Present(2); + /// assert_eq!(x.is_null(), false); + /// + /// let x: Nullable = Nullable::Null; + /// assert_eq!(x.is_null(), true); + /// ``` + #[inline] + pub fn is_null(&self) -> bool { + !self.is_present() + } + + ///////////////////////////////////////////////////////////////////////// + // Adapter for working with references + ///////////////////////////////////////////////////////////////////////// + + /// Converts from `Nullable` to `Nullable<&T>`. + /// + /// # Examples + /// + /// Convert an `Nullable<`[`String`]`>` into a `Nullable<`[`usize`]`>`, preserving the original. + /// The [`map`] method takes the `self` argument by value, consuming the original, + /// so this technique uses `as_ref` to first take a `Nullable` to a reference + /// to the value inside the original. + /// + /// [`map`]: enum.Nullable.html#method.map + /// [`String`]: ../../std/string/struct.String.html + /// [`usize`]: ../../std/primitive.usize.html + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let num_as_str: Nullable = Nullable::Present("10".to_string()); + /// // First, cast `Nullable` to `Nullable<&String>` with `as_ref`, + /// // then consume *that* with `map`, leaving `num_as_str` on the stack. + /// let num_as_int: Nullable = num_as_str.as_ref().map(|n| n.len()); + /// println!("still can print num_as_str: {:?}", num_as_str); + /// ``` + #[inline] + pub fn as_ref(&self) -> Nullable<&T> { + match *self { + Nullable::Present(ref x) => Nullable::Present(x), + Nullable::Null => Nullable::Null, + } + } + + /// Converts from `Nullable` to `Nullable<&mut T>`. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let mut x = Nullable::Present(2); + /// match x.as_mut() { + /// Nullable::Present(v) => *v = 42, + /// Nullable::Null => {}, + /// } + /// assert_eq!(x, Nullable::Present(42)); + /// ``` + #[inline] + pub fn as_mut(&mut self) -> Nullable<&mut T> { + match *self { + Nullable::Present(ref mut x) => Nullable::Present(x), + Nullable::Null => Nullable::Null, + } + } + + ///////////////////////////////////////////////////////////////////////// + // Getting to contained values + ///////////////////////////////////////////////////////////////////////// + + /// Unwraps a Nullable, yielding the content of a `Nullable::Present`. + /// + /// # Panics + /// + /// Panics if the value is a [`Nullable::Null`] with a custom panic message provided by + /// `msg`. + /// + /// [`Nullable::Null`]: #variant.Null + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = Nullable::Present("value"); + /// assert_eq!(x.expect("the world is ending"), "value"); + /// ``` + /// + /// ```{.should_panic} + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x: Nullable<&str> = Nullable::Null; + /// x.expect("the world is ending"); // panics with `the world is ending` + /// ``` + #[inline] + pub fn expect(self, msg: &str) -> T { + match self { + Nullable::Present(val) => val, + Nullable::Null => expect_failed(msg), + } + } + + /// Moves the value `v` out of the `Nullable` if it is `Nullable::Present(v)`. + /// + /// In general, because this function may panic, its use is discouraged. + /// Instead, prefer to use pattern matching and handle the `Nullable::Null` + /// case explicitly. + /// + /// # Panics + /// + /// Panics if the self value equals [`Nullable::Null`]. + /// + /// [`Nullable::Null`]: #variant.Null + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = Nullable::Present("air"); + /// assert_eq!(x.unwrap(), "air"); + /// ``` + /// + /// ```{.should_panic} + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.unwrap(), "air"); // fails + /// ``` + #[inline] + pub fn unwrap(self) -> T { + match self { + Nullable::Present(val) => val, + Nullable::Null => panic!("called `Nullable::unwrap()` on a `Nullable::Null` value"), + } + } + + /// Returns the contained value or a default. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// assert_eq!(Nullable::Present("car").unwrap_or("bike"), "car"); + /// assert_eq!(Nullable::Null.unwrap_or("bike"), "bike"); + /// ``` + #[inline] + pub fn unwrap_or(self, def: T) -> T { + match self { + Nullable::Present(x) => x, + Nullable::Null => def, + } + } + + /// Returns the contained value or computes it from a closure. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let k = 10; + /// assert_eq!(Nullable::Present(4).unwrap_or_else(|| 2 * k), 4); + /// assert_eq!(Nullable::Null.unwrap_or_else(|| 2 * k), 20); + /// ``` + #[inline] + pub fn unwrap_or_else T>(self, f: F) -> T { + match self { + Nullable::Present(x) => x, + Nullable::Null => f(), + } + } + + ///////////////////////////////////////////////////////////////////////// + // Transforming contained values + ///////////////////////////////////////////////////////////////////////// + + /// Maps a `Nullable` to `Nullable` by applying a function to a contained value. + /// + /// # Examples + /// + /// Convert a `Nullable<`[`String`]`>` into a `Nullable<`[`usize`]`>`, consuming the original: + /// + /// [`String`]: ../../std/string/struct.String.html + /// [`usize`]: ../../std/primitive.usize.html + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let maybe_some_string = Nullable::Present(String::from("Hello, World!")); + /// // `Nullable::map` takes self *by value*, consuming `maybe_some_string` + /// let maybe_some_len = maybe_some_string.map(|s| s.len()); + /// + /// assert_eq!(maybe_some_len, Nullable::Present(13)); + /// ``` + #[inline] + pub fn map U>(self, f: F) -> Nullable { + match self { + Nullable::Present(x) => Nullable::Present(f(x)), + Nullable::Null => Nullable::Null, + } + } + + /// Applies a function to the contained value (if any), + /// or returns a `default` (if not). + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = Nullable::Present("foo"); + /// assert_eq!(x.map_or(42, |v| v.len()), 3); + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.map_or(42, |v| v.len()), 42); + /// ``` + #[inline] + pub fn map_or U>(self, default: U, f: F) -> U { + match self { + Nullable::Present(t) => f(t), + Nullable::Null => default, + } + } + + /// Applies a function to the contained value (if any), + /// or computes a `default` (if not). + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let k = 21; + /// + /// let x = Nullable::Present("foo"); + /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 3); + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42); + /// ``` + #[inline] + pub fn map_or_else U, F: FnOnce(T) -> U>(self, default: D, f: F) -> U { + match self { + Nullable::Present(t) => f(t), + Nullable::Null => default(), + } + } + + /// Transforms the `Nullable` into a [`Result`], mapping `Nullable::Present(v)` to + /// [`Ok(v)`] and `Nullable::Null` to [`Err(err)`][Err]. + /// + /// [`Result`]: ../../std/result/enum.Result.html + /// [`Ok(v)`]: ../../std/result/enum.Result.html#variant.Ok + /// [Err]: ../../std/result/enum.Result.html#variant.Err + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = Nullable::Present("foo"); + /// assert_eq!(x.ok_or(0), Ok("foo")); + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.ok_or(0), Err(0)); + /// ``` + #[inline] + pub fn ok_or(self, err: E) -> Result { + match self { + Nullable::Present(v) => Ok(v), + Nullable::Null => Err(err), + } + } + + /// Transforms the `Nullable` into a [`Result`], mapping `Nullable::Present(v)` to + /// [`Ok(v)`] and `Nullable::Null` to [`Err(err())`][Err]. + /// + /// [`Result`]: ../../std/result/enum.Result.html + /// [`Ok(v)`]: ../../std/result/enum.Result.html#variant.Ok + /// [Err]: ../../std/result/enum.Result.html#variant.Err + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = Nullable::Present("foo"); + /// assert_eq!(x.ok_or_else(|| 0), Ok("foo")); + /// + /// let x: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.ok_or_else(|| 0), Err(0)); + /// ``` + #[inline] + pub fn ok_or_else E>(self, err: F) -> Result { + match self { + Nullable::Present(v) => Ok(v), + Nullable::Null => Err(err()), + } + } + + ///////////////////////////////////////////////////////////////////////// + // Boolean operations on the values, eager and lazy + ///////////////////////////////////////////////////////////////////////// + + /// Returns `Nullable::Null` if the Nullable is `Nullable::Null`, otherwise returns `optb`. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = Nullable::Present(2); + /// let y: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.and(y), Nullable::Null); + /// + /// let x: Nullable = Nullable::Null; + /// let y = Nullable::Present("foo"); + /// assert_eq!(x.and(y), Nullable::Null); + /// + /// let x = Nullable::Present(2); + /// let y = Nullable::Present("foo"); + /// assert_eq!(x.and(y), Nullable::Present("foo")); + /// + /// let x: Nullable = Nullable::Null; + /// let y: Nullable<&str> = Nullable::Null; + /// assert_eq!(x.and(y), Nullable::Null); + /// ``` + #[inline] + pub fn and(self, optb: Nullable) -> Nullable { + match self { + Nullable::Present(_) => optb, + Nullable::Null => Nullable::Null, + } + } + + /// Returns `Nullable::Null` if the Nullable is `Nullable::Null`, otherwise calls `f` with the + /// wrapped value and returns the result. + /// + /// Some languages call this operation flatmap. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// fn sq(x: u32) -> Nullable { Nullable::Present(x * x) } + /// fn nope(_: u32) -> Nullable { Nullable::Null } + /// + /// assert_eq!(Nullable::Present(2).and_then(sq).and_then(sq), Nullable::Present(16)); + /// assert_eq!(Nullable::Present(2).and_then(sq).and_then(nope), Nullable::Null); + /// assert_eq!(Nullable::Present(2).and_then(nope).and_then(sq), Nullable::Null); + /// assert_eq!(Nullable::Null.and_then(sq).and_then(sq), Nullable::Null); + /// ``` + #[inline] + pub fn and_then Nullable>(self, f: F) -> Nullable { + match self { + Nullable::Present(x) => f(x), + Nullable::Null => Nullable::Null, + } + } + + /// Returns the Nullable if it contains a value, otherwise returns `optb`. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = Nullable::Present(2); + /// let y = Nullable::Null; + /// assert_eq!(x.or(y), Nullable::Present(2)); + /// + /// let x = Nullable::Null; + /// let y = Nullable::Present(100); + /// assert_eq!(x.or(y), Nullable::Present(100)); + /// + /// let x = Nullable::Present(2); + /// let y = Nullable::Present(100); + /// assert_eq!(x.or(y), Nullable::Present(2)); + /// + /// let x: Nullable = Nullable::Null; + /// let y = Nullable::Null; + /// assert_eq!(x.or(y), Nullable::Null); + /// ``` + #[inline] + pub fn or(self, optb: Nullable) -> Nullable { + match self { + Nullable::Present(_) => self, + Nullable::Null => optb, + } + } + + /// Returns the Nullable if it contains a value, otherwise calls `f` and + /// returns the result. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// fn nobody() -> Nullable<&'static str> { Nullable::Null } + /// fn vikings() -> Nullable<&'static str> { Nullable::Present("vikings") } + /// + /// assert_eq!(Nullable::Present("barbarians").or_else(vikings), + /// Nullable::Present("barbarians")); + /// assert_eq!(Nullable::Null.or_else(vikings), Nullable::Present("vikings")); + /// assert_eq!(Nullable::Null.or_else(nobody), Nullable::Null); + /// ``` + #[inline] + pub fn or_else Nullable>(self, f: F) -> Nullable { + match self { + Nullable::Present(_) => self, + Nullable::Null => f(), + } + } + + ///////////////////////////////////////////////////////////////////////// + // Misc + ///////////////////////////////////////////////////////////////////////// + + /// Takes the value out of the Nullable, leaving a `Nullable::Null` in its place. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let mut x = Nullable::Present(2); + /// x.take(); + /// assert_eq!(x, Nullable::Null); + /// + /// let mut x: Nullable = Nullable::Null; + /// x.take(); + /// assert_eq!(x, Nullable::Null); + /// ``` + #[inline] + pub fn take(&mut self) -> Nullable { + mem::replace(self, Nullable::Null) + } +} + +impl<'a, T: Clone> Nullable<&'a T> { + /// Maps an `Nullable<&T>` to an `Nullable` by cloning the contents of the + /// Nullable. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = 12; + /// let opt_x = Nullable::Present(&x); + /// assert_eq!(opt_x, Nullable::Present(&12)); + /// let cloned = opt_x.cloned(); + /// assert_eq!(cloned, Nullable::Present(12)); + /// ``` + pub fn cloned(self) -> Nullable { + self.map(Clone::clone) + } +} + +impl Nullable { + /// Returns the contained value or a default + /// + /// Consumes the `self` argument then, if `Nullable::Present`, returns the contained + /// value, otherwise if `Nullable::Null`, returns the default value for that + /// type. + /// + /// # Examples + /// + /// ``` + /// # use rust_axum_validation_test::types::Nullable; + /// + /// let x = Nullable::Present(42); + /// assert_eq!(42, x.unwrap_or_default()); + /// + /// let y: Nullable = Nullable::Null; + /// assert_eq!(0, y.unwrap_or_default()); + /// ``` + #[inline] + pub fn unwrap_or_default(self) -> T { + match self { + Nullable::Present(x) => x, + Nullable::Null => Default::default(), + } + } +} + +impl Default for Nullable { + /// Returns None. + #[inline] + fn default() -> Nullable { + Nullable::Null + } +} + +impl From for Nullable { + fn from(val: T) -> Nullable { + Nullable::Present(val) + } +} + +impl Serialize for Nullable +where + T: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + Nullable::Present(ref inner) => serializer.serialize_some(&inner), + Nullable::Null => serializer.serialize_none(), + } + } +} + +impl<'de, T> Deserialize<'de> for Nullable +where + T: serde::de::DeserializeOwned, +{ + fn deserialize(deserializer: D) -> Result, D::Error> + where + D: Deserializer<'de>, + { + // In order to deserialize a required, but nullable, value, we first have to check whether + // the value is present at all. To do this, we deserialize to a serde_json::Value, which + // fails if the value is missing, or gives serde_json::Value::Null if the value is present. + // If that succeeds as null, we can easily return a Null. + // If that succeeds as some value, we deserialize that value and return a Present. + // If that errors, we return the error. + let presence: Result<::serde_json::Value, _> = + serde::Deserialize::deserialize(deserializer); + match presence { + Ok(serde_json::Value::Null) => Ok(Nullable::Null), + Ok(some_value) => serde_json::from_value(some_value) + .map(Nullable::Present) + .map_err(serde::de::Error::custom), + Err(x) => Err(x), + } + } +} + +#[inline(never)] +#[cold] +fn expect_failed(msg: &str) -> ! { + panic!("{}", msg) +} + +#[derive(Debug, Clone, PartialEq, PartialOrd)] +/// Base64-encoded byte array +pub struct ByteArray(pub Vec); + +impl Serialize for ByteArray { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(&general_purpose::STANDARD.encode(&self.0)) + } +} + +impl<'de> Deserialize<'de> for ByteArray { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match general_purpose::STANDARD.decode(s) { + Ok(bin) => Ok(ByteArray(bin)), + _ => Err(serde::de::Error::custom("invalid base64")), + } + } +} diff --git a/samples/server/petstore/rust-server/Cargo.toml b/samples/server/petstore/rust-server/Cargo.toml index 68d06c54103b..c086d1f01388 100644 --- a/samples/server/petstore/rust-server/Cargo.toml +++ b/samples/server/petstore/rust-server/Cargo.toml @@ -1,2 +1,3 @@ [workspace] members = ["output/*"] +resolver = "2" diff --git a/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml b/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml index de78c375dc07..60992d137b84 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml @@ -5,7 +5,7 @@ authors = ["OpenAPI Generator team and contributors"] description = "API under test" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [features] default = ["client", "server"] diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs index 6d043d4a086e..ea2a11d63dac 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs @@ -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/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs index c3ab4bd0e641..9bf8330d4461 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs @@ -81,7 +81,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(), )) } @@ -206,10 +206,11 @@ impl hyper::service::Service<(Request, C)> for Service where Some("application/json") if param_object_field.is_none() => { // Extract JSON part. let deserializer = &mut serde_json::Deserializer::from_slice(part.body.as_slice()); - let json_data: models::MultipartRequestObjectField = 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: models::MultipartRequestObjectField = 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/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml b/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml index 95fe3c653d22..94c1dfcf421a 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml @@ -5,7 +5,7 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [features] default = ["client", "server"] diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs index 35dd1cad90df..8c66235e7b73 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs @@ -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/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs index 1e951f6e0e72..496d89296365 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs @@ -70,7 +70,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(), )) } @@ -150,10 +150,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_op_get_request: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_op_get_request) => param_op_get_request, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml b/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml index f43c739c7784..dd0059807bbc 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml @@ -5,7 +5,7 @@ authors = ["OpenAPI Generator team and contributors"] description = "API under test" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [features] default = ["client", "server"] diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs index 3f3d2b0cf82f..cfc2f9059c3e 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs @@ -85,7 +85,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/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs index d57ac04aef26..e7432c18c656 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs @@ -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/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs index 3808a67d7573..3825329a51ec 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs @@ -155,7 +155,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(), )) } @@ -1269,10 +1269,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_object_untyped_props: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_object_untyped_props) => param_object_untyped_props, Err(_) => None, } @@ -1368,10 +1369,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_duplicate_xml_object: Option = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); - 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_duplicate_xml_object) => param_duplicate_xml_object, Err(_) => None, } @@ -1435,10 +1437,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_another_xml_object: Option = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); - 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_another_xml_object) => param_another_xml_object, Err(_) => None, } @@ -1513,10 +1516,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_another_xml_array: Option = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); - 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_another_xml_array) => param_another_xml_array, Err(_) => None, } @@ -1580,10 +1584,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_xml_array: Option = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); - 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_xml_array) => param_xml_array, Err(_) => None, } @@ -1647,10 +1652,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_xml_object: Option = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); - 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_xml_object) => param_xml_object, Err(_) => None, } @@ -1714,10 +1720,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_object_param: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_object_param) => param_object_param, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) diff --git a/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml b/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml index 27a63250cf4c..75d7eba1f3ed 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml @@ -5,7 +5,7 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [features] default = ["client", "server"] diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs index bb16cef8ed5d..38647fd39e51 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs @@ -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/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs index e27cc1ed58c6..d922ae3966f6 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs @@ -178,7 +178,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/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml index abfbb6775106..4907e0db9aa5 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml @@ -4,7 +4,7 @@ version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\" license = "Apache-2.0" -edition = "2018" +edition = "2021" publish = ["crates-io"] [features] diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs index 17501af77f4e..45d06cadaae0 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs @@ -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/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index ea3e74c470f2..ff2047c16f40 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -188,7 +188,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(), )) } @@ -268,10 +268,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -377,10 +378,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(_) => None, } @@ -447,10 +449,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(_) => None, } @@ -517,10 +520,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(_) => None, } @@ -587,10 +591,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(_) => None, } @@ -766,10 +771,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -840,10 +846,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -1136,10 +1143,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_param: Option> = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_param) => param_param, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -1254,10 +1262,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -1364,10 +1373,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -1803,10 +1813,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -2318,10 +2329,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -2402,10 +2414,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -2475,10 +2488,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option> = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -2548,10 +2562,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option> = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -2927,10 +2942,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_body) => param_body, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) diff --git a/samples/server/petstore/rust-server/output/ping-bearer-auth/Cargo.toml b/samples/server/petstore/rust-server/output/ping-bearer-auth/Cargo.toml index 4a9f77118d23..97c08a3b7401 100644 --- a/samples/server/petstore/rust-server/output/ping-bearer-auth/Cargo.toml +++ b/samples/server/petstore/rust-server/output/ping-bearer-auth/Cargo.toml @@ -5,7 +5,7 @@ authors = ["OpenAPI Generator team and contributors"] description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [features] default = ["client", "server"] diff --git a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/lib.rs b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/lib.rs index aa43ad0d5974..5377932e173f 100644 --- a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/lib.rs +++ b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/lib.rs @@ -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/samples/server/petstore/rust-server/output/ping-bearer-auth/src/server/mod.rs b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/server/mod.rs index 0657f06dd602..331ede91fd7c 100644 --- a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/server/mod.rs @@ -70,7 +70,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/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml b/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml index fc7a95339319..fb4de1e4651a 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml +++ b/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml @@ -5,7 +5,7 @@ authors = ["OpenAPI Generator team and contributors"] description = "This spec is for testing rust-server-specific things" # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" -edition = "2018" +edition = "2021" [features] default = ["client", "server"] diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs index 01365afbb0fa..06cbfc39c152 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs @@ -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/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs index 3152eb63a364..6d0b342010ac 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs @@ -92,7 +92,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(), )) } @@ -237,10 +237,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_nested_response: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_nested_response) => param_nested_response, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) @@ -547,10 +548,11 @@ impl hyper::service::Service<(Request, C)> for Service where let mut unused_elements = Vec::new(); let param_value: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&body); - 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_value) => param_value, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java index c23b129b45e2..f1ba94d0ff19 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java @@ -28,6 +28,10 @@ public class AdditionalPropertiesAnyType { private String name; + public AdditionalPropertiesAnyType() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java index fc51276e7fe1..7bcba25e7ea5 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java @@ -29,6 +29,10 @@ public class AdditionalPropertiesArray { private String name; + public AdditionalPropertiesArray() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java index a66236a71e52..492427d7098a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -28,6 +28,10 @@ public class AdditionalPropertiesBoolean { private String name; + public AdditionalPropertiesBoolean() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index 621c373ed5d4..18ce5603da38 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -59,6 +59,10 @@ public class AdditionalPropertiesClass { private Object anytype3; + public AdditionalPropertiesClass() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java index 8a0b80d732f9..501fa16aeb68 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java @@ -28,6 +28,10 @@ public class AdditionalPropertiesInteger { private String name; + public AdditionalPropertiesInteger() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java index ec1fc685cb58..9c9bdc0af3dd 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java @@ -29,6 +29,10 @@ public class AdditionalPropertiesNumber { private String name; + public AdditionalPropertiesNumber() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java index 7042e9c87604..5020e0c4a0fc 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java @@ -29,6 +29,10 @@ public class AdditionalPropertiesObject { private String name; + public AdditionalPropertiesObject() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesString.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesString.java index 0a00d336a0b5..3d61884ec64f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesString.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesString.java @@ -28,6 +28,10 @@ public class AdditionalPropertiesString { private String name; + public AdditionalPropertiesString() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index 29e702de9204..aa8ac0cb6864 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -29,6 +29,10 @@ public class ArrayOfArrayOfNumberOnly { @Valid private List> arrayArrayNumber = new ArrayList<>(); + public ArrayOfArrayOfNumberOnly() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java index cbe4c35c2ef7..1c8cc37f044a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -29,6 +29,10 @@ public class ArrayOfNumberOnly { @Valid private List arrayNumber = new ArrayList<>(); + public ArrayOfNumberOnly() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayTest.java index 4e6b1b5a6490..99139106d80a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayTest.java @@ -35,6 +35,10 @@ public class ArrayTest { @Valid private List> arrayArrayOfModel = new ArrayList<>(); + public ArrayTest() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java index fd9d326a3fda..2783189e3ec9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java @@ -34,6 +34,10 @@ public class Capitalization { private String ATT_NAME; + public Capitalization() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ChildWithNullable.java index b36fda25a2ed..92b5bcea5580 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ChildWithNullable.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ChildWithNullable.java @@ -32,6 +32,10 @@ public class ChildWithNullable extends ParentWithNullable { private String otherProperty; + public ChildWithNullable() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java index c8bb2dca34cd..77c8c64d966a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java @@ -25,6 +25,10 @@ public class ClassModel { private String propertyClass; + public ClassModel() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java index 74819d7c311b..5290114a5bd1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java @@ -24,6 +24,10 @@ public class Client { private String client; + public Client() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java index ab870b37276d..00dd39a8371c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java @@ -101,6 +101,10 @@ public static ArrayEnumEnum fromValue(String value) { @Valid private List arrayEnum = new ArrayList<>(); + public EnumArrays() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/File.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/File.java index 6ef3c320227a..d655a98f4dc4 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/File.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/File.java @@ -25,6 +25,10 @@ public class File { private String sourceURI; + public File() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FileSchemaTestClass.java index f106dc68e9b3..d59eadd12e78 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FileSchemaTestClass.java @@ -31,6 +31,10 @@ public class FileSchemaTestClass { @Valid private List<@Valid File> files = new ArrayList<>(); + public FileSchemaTestClass() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index fc94f54a4697..12b1230ba0aa 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -28,6 +28,10 @@ public class HasOnlyReadOnly { private String foo; + public HasOnlyReadOnly() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java index 6f638c2b72e3..5998be729c2a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java @@ -72,6 +72,10 @@ public static InnerEnum fromValue(String value) { @Valid private Map indirectMap = new HashMap<>(); + public MapTest() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index f7970038721c..1842333561b6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -36,6 +36,10 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @Valid private Map map = new HashMap<>(); + public MixedPropertiesAndAdditionalPropertiesClass() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java index 3b8a6f1d382d..a04376d8a065 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java @@ -29,6 +29,10 @@ public class Model200Response { private String propertyClass; + public Model200Response() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java index 28ae571cd55b..da593af8efa0 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -30,6 +30,10 @@ public class ModelApiResponse { private String message; + public ModelApiResponse() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelList.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelList.java index 5b9431563606..2c384f372e8d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelList.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelList.java @@ -26,6 +26,10 @@ public class ModelList { private String _123list; + public ModelList() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java index a71209706548..235a0e075b97 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java @@ -27,6 +27,10 @@ public class ModelReturn { private Integer _return; + public ModelReturn() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java index 6bec6b28d5e9..52fe66679bee 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -30,6 +30,10 @@ public class NullableMapProperty { @Valid private JsonNullable> languageValues = JsonNullable.>undefined(); + public NullableMapProperty() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java index 51ddc40e97e6..07495c0ca643 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java @@ -25,6 +25,10 @@ public class NumberOnly { private BigDecimal justNumber; + public NumberOnly() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java index c1145764a9e4..ea4ec9917686 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java @@ -75,6 +75,10 @@ public static StatusEnum fromValue(String value) { private Boolean complete = false; + public Order() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java index 541497ab0f62..3db47074fdf3 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java @@ -29,6 +29,10 @@ public class OuterComposite { private Boolean myBoolean; + public OuterComposite() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java index 1ac5ed427457..5a29afced4d9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -75,6 +75,10 @@ public static TypeEnum fromValue(String value) { private JsonNullable nullableProperty = JsonNullable.undefined(); + public ParentWithNullable() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 152af21dc2cc..3ac0d6465033 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -26,6 +26,10 @@ public class ReadOnlyFirst { private String baz; + public ReadOnlyFirst() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java index 8687f7af05e0..31114324f117 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java @@ -30,6 +30,10 @@ public class ResponseObjectWithDifferentFieldNames { private String propertyNameWithSpaces; + public ResponseObjectWithDifferentFieldNames() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java index 8476919848d8..f9e5a4809384 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java @@ -26,6 +26,10 @@ public class SpecialModelName { private Long $specialPropertyName; + public SpecialModelName() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java index 69764cb722e3..75698837b571 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java @@ -26,6 +26,10 @@ public class Tag { private String name; + public Tag() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java index 5aff42506b87..5ea2d489d982 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java @@ -38,6 +38,10 @@ public class User { private Integer userStatus; + public User() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/XmlItem.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/XmlItem.java index be92432db0e0..851db8c707b3 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/XmlItem.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/XmlItem.java @@ -93,6 +93,10 @@ public class XmlItem { @Valid private List prefixNsWrappedArray = new ArrayList<>(); + public XmlItem() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Category.java index 398fe66d0470..297b5231d934 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Category.java @@ -44,5 +44,69 @@ public Category name(String name) { + + public static class Builder { + + private Category instance; + + public Builder() { + this(new Category()); + } + + protected Builder(Category instance) { + this.instance = instance; + } + + protected Builder copyOf(Category value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Category.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Category.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Category instance. + * + * The builder is not reusable (NullPointerException) + */ + public Category build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Category.Builder builder() { + return new Category.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Category.Builder toBuilder() { + Category.Builder builder = new Category.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/ModelApiResponse.java index f28be03c009f..b6b297719888 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -54,5 +54,75 @@ public ModelApiResponse message(String message) { + + public static class Builder { + + private ModelApiResponse instance; + + public Builder() { + this(new ModelApiResponse()); + } + + protected Builder(ModelApiResponse instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelApiResponse value) { + this.instance.setCode(value.code); + this.instance.setType(value.type); + this.instance.setMessage(value.message); + return this; + } + + public ModelApiResponse.Builder code(Integer code) { + this.instance.code(code); + return this; + } + + public ModelApiResponse.Builder type(String type) { + this.instance.type(type); + return this; + } + + public ModelApiResponse.Builder message(String message) { + this.instance.message(message); + return this; + } + + /** + * returns a built ModelApiResponse instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelApiResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelApiResponse.Builder builder() { + return new ModelApiResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelApiResponse.Builder toBuilder() { + ModelApiResponse.Builder builder = new ModelApiResponse.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Order.java index 5681677d4b91..7565138dfe3b 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Order.java @@ -117,5 +117,93 @@ public Order complete(Boolean complete) { + + public static class Builder { + + private Order instance; + + public Builder() { + this(new Order()); + } + + protected Builder(Order instance) { + this.instance = instance; + } + + protected Builder copyOf(Order value) { + this.instance.setId(value.id); + this.instance.setPetId(value.petId); + this.instance.setQuantity(value.quantity); + this.instance.setShipDate(value.shipDate); + this.instance.setStatus(value.status); + this.instance.setComplete(value.complete); + return this; + } + + public Order.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Order.Builder petId(Long petId) { + this.instance.petId(petId); + return this; + } + + public Order.Builder quantity(Integer quantity) { + this.instance.quantity(quantity); + return this; + } + + public Order.Builder shipDate(OffsetDateTime shipDate) { + this.instance.shipDate(shipDate); + return this; + } + + public Order.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + + public Order.Builder complete(Boolean complete) { + this.instance.complete(complete); + return this; + } + + /** + * returns a built Order instance. + * + * The builder is not reusable (NullPointerException) + */ + public Order build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Order.Builder builder() { + return new Order.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Order.Builder toBuilder() { + Order.Builder builder = new Order.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Pet.java index f01d1ef787d2..041591f138f7 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Pet.java @@ -150,5 +150,95 @@ public Pet status(StatusEnum status) { + + public static class Builder { + + private Pet instance; + + public Builder() { + this(new Pet()); + } + + protected Builder(Pet instance) { + this.instance = instance; + } + + protected Builder copyOf(Pet value) { + this.instance.setId(value.id); + this.instance.setCategory(value.category); + this.instance.setName(value.name); + this.instance.setPhotoUrls(value.photoUrls); + this.instance.setTags(value.tags); + this.instance.setStatus(value.status); + return this; + } + + public Pet.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Pet.Builder category(Category category) { + this.instance.category(category); + return this; + } + + public Pet.Builder name(String name) { + this.instance.name(name); + return this; + } + + public Pet.Builder photoUrls(List photoUrls) { + this.instance.photoUrls(photoUrls); + return this; + } + + public Pet.Builder tags(List<@Valid Tag> tags) { + this.instance.tags(tags); + return this; + } + + @Deprecated + public Pet.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + @Deprecated + + /** + * returns a built Pet instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pet.Builder builder() { + return new Pet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pet.Builder toBuilder() { + Pet.Builder builder = new Pet.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Tag.java index 21c1fc612a3b..e23ba7cc4d11 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/Tag.java @@ -44,5 +44,69 @@ public Tag name(String name) { + + public static class Builder { + + private Tag instance; + + public Builder() { + this(new Tag()); + } + + protected Builder(Tag instance) { + this.instance = instance; + } + + protected Builder copyOf(Tag value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Tag.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Tag.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Tag instance. + * + * The builder is not reusable (NullPointerException) + */ + public Tag build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Tag.Builder builder() { + return new Tag.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Tag.Builder toBuilder() { + Tag.Builder builder = new Tag.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/User.java index 7dfdf067e5cd..8593562277cc 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/model/User.java @@ -92,5 +92,105 @@ public User userStatus(Integer userStatus) { + + public static class Builder { + + private User instance; + + public Builder() { + this(new User()); + } + + protected Builder(User instance) { + this.instance = instance; + } + + protected Builder copyOf(User value) { + this.instance.setId(value.id); + this.instance.setUsername(value.username); + this.instance.setFirstName(value.firstName); + this.instance.setLastName(value.lastName); + this.instance.setEmail(value.email); + this.instance.setPassword(value.password); + this.instance.setPhone(value.phone); + this.instance.setUserStatus(value.userStatus); + return this; + } + + public User.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public User.Builder username(String username) { + this.instance.username(username); + return this; + } + + public User.Builder firstName(String firstName) { + this.instance.firstName(firstName); + return this; + } + + public User.Builder lastName(String lastName) { + this.instance.lastName(lastName); + return this; + } + + public User.Builder email(String email) { + this.instance.email(email); + return this; + } + + public User.Builder password(String password) { + this.instance.password(password); + return this; + } + + public User.Builder phone(String phone) { + this.instance.phone(phone); + return this; + } + + public User.Builder userStatus(Integer userStatus) { + this.instance.userStatus(userStatus); + return this; + } + + /** + * returns a built User instance. + * + * The builder is not reusable (NullPointerException) + */ + public User build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static User.Builder builder() { + return new User.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public User.Builder toBuilder() { + User.Builder builder = new User.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java index 4ae2f2bdd964..f3eb99238909 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java @@ -124,5 +124,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesAnyType instance; + + public Builder() { + this(new AdditionalPropertiesAnyType()); + } + + protected Builder(AdditionalPropertiesAnyType instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesAnyType value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesAnyType.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesAnyType.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesAnyType instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesAnyType build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesAnyType.Builder builder() { + return new AdditionalPropertiesAnyType.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesAnyType.Builder toBuilder() { + AdditionalPropertiesAnyType.Builder builder = new AdditionalPropertiesAnyType.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java index 2233a85264eb..b6bfd56b3e81 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java @@ -125,5 +125,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesArray instance; + + public Builder() { + this(new AdditionalPropertiesArray()); + } + + protected Builder(AdditionalPropertiesArray instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesArray value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesArray.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesArray.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesArray instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesArray build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesArray.Builder builder() { + return new AdditionalPropertiesArray.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesArray.Builder toBuilder() { + AdditionalPropertiesArray.Builder builder = new AdditionalPropertiesArray.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java index 07cb595c94d5..b3277d02e174 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -124,5 +124,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesBoolean instance; + + public Builder() { + this(new AdditionalPropertiesBoolean()); + } + + protected Builder(AdditionalPropertiesBoolean instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesBoolean value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesBoolean.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesBoolean.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesBoolean instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesBoolean build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesBoolean.Builder builder() { + return new AdditionalPropertiesBoolean.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesBoolean.Builder toBuilder() { + AdditionalPropertiesBoolean.Builder builder = new AdditionalPropertiesBoolean.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index 9c16759329f4..3a87a5601db2 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -410,5 +410,128 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesClass instance; + + public Builder() { + this(new AdditionalPropertiesClass()); + } + + protected Builder(AdditionalPropertiesClass instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesClass value) { + this.instance.setMapString(value.mapString); + this.instance.setMapNumber(value.mapNumber); + this.instance.setMapInteger(value.mapInteger); + this.instance.setMapBoolean(value.mapBoolean); + this.instance.setMapArrayInteger(value.mapArrayInteger); + this.instance.setMapArrayAnytype(value.mapArrayAnytype); + this.instance.setMapMapString(value.mapMapString); + this.instance.setMapMapAnytype(value.mapMapAnytype); + this.instance.setAnytype1(value.anytype1); + this.instance.setAnytype2(value.anytype2); + this.instance.setAnytype3(value.anytype3); + return this; + } + + public AdditionalPropertiesClass.Builder mapString(Map mapString) { + this.instance.mapString(mapString); + return this; + } + + public AdditionalPropertiesClass.Builder mapNumber(Map mapNumber) { + this.instance.mapNumber(mapNumber); + return this; + } + + public AdditionalPropertiesClass.Builder mapInteger(Map mapInteger) { + this.instance.mapInteger(mapInteger); + return this; + } + + public AdditionalPropertiesClass.Builder mapBoolean(Map mapBoolean) { + this.instance.mapBoolean(mapBoolean); + return this; + } + + public AdditionalPropertiesClass.Builder mapArrayInteger(Map> mapArrayInteger) { + this.instance.mapArrayInteger(mapArrayInteger); + return this; + } + + public AdditionalPropertiesClass.Builder mapArrayAnytype(Map> mapArrayAnytype) { + this.instance.mapArrayAnytype(mapArrayAnytype); + return this; + } + + public AdditionalPropertiesClass.Builder mapMapString(Map> mapMapString) { + this.instance.mapMapString(mapMapString); + return this; + } + + public AdditionalPropertiesClass.Builder mapMapAnytype(Map> mapMapAnytype) { + this.instance.mapMapAnytype(mapMapAnytype); + return this; + } + + public AdditionalPropertiesClass.Builder anytype1(Object anytype1) { + this.instance.anytype1(anytype1); + return this; + } + + public AdditionalPropertiesClass.Builder anytype2(Object anytype2) { + this.instance.anytype2(anytype2); + return this; + } + + public AdditionalPropertiesClass.Builder anytype2(JsonNullable anytype2) { + this.instance.anytype2 = anytype2; + return this; + } + + public AdditionalPropertiesClass.Builder anytype3(Object anytype3) { + this.instance.anytype3(anytype3); + return this; + } + + /** + * returns a built AdditionalPropertiesClass instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesClass.Builder builder() { + return new AdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesClass.Builder toBuilder() { + AdditionalPropertiesClass.Builder builder = new AdditionalPropertiesClass.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java index 42784d373a04..d049914a7ec1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java @@ -124,5 +124,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesInteger instance; + + public Builder() { + this(new AdditionalPropertiesInteger()); + } + + protected Builder(AdditionalPropertiesInteger instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesInteger value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesInteger.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesInteger.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesInteger instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesInteger build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesInteger.Builder builder() { + return new AdditionalPropertiesInteger.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesInteger.Builder toBuilder() { + AdditionalPropertiesInteger.Builder builder = new AdditionalPropertiesInteger.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java index fc0ed8c8f31e..63ddfaba3bf0 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java @@ -125,5 +125,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesNumber instance; + + public Builder() { + this(new AdditionalPropertiesNumber()); + } + + protected Builder(AdditionalPropertiesNumber instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesNumber value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesNumber.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesNumber.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesNumber instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesNumber build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesNumber.Builder builder() { + return new AdditionalPropertiesNumber.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesNumber.Builder toBuilder() { + AdditionalPropertiesNumber.Builder builder = new AdditionalPropertiesNumber.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java index 964ae18650a2..992d20812f68 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java @@ -125,5 +125,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesObject instance; + + public Builder() { + this(new AdditionalPropertiesObject()); + } + + protected Builder(AdditionalPropertiesObject instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesObject value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesObject.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesObject.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesObject instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesObject build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesObject.Builder builder() { + return new AdditionalPropertiesObject.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesObject.Builder toBuilder() { + AdditionalPropertiesObject.Builder builder = new AdditionalPropertiesObject.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesString.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesString.java index 6114e3675403..e7c88efce4a4 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesString.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesString.java @@ -124,5 +124,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesString instance; + + public Builder() { + this(new AdditionalPropertiesString()); + } + + protected Builder(AdditionalPropertiesString instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesString value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesString.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesString.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesString instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesString build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesString.Builder builder() { + return new AdditionalPropertiesString.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesString.Builder toBuilder() { + AdditionalPropertiesString.Builder builder = new AdditionalPropertiesString.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java index d989505862d5..b8839c1929b6 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java @@ -129,5 +129,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Animal instance; + + public Builder() { + this(new Animal()); + } + + protected Builder(Animal instance) { + this.instance = instance; + } + + protected Builder copyOf(Animal value) { + this.instance.setClassName(value.className); + this.instance.setColor(value.color); + return this; + } + + public Animal.Builder className(String className) { + this.instance.className(className); + return this; + } + + public Animal.Builder color(String color) { + this.instance.color(color); + return this; + } + + /** + * returns a built Animal instance. + * + * The builder is not reusable (NullPointerException) + */ + public Animal build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Animal.Builder builder() { + return new Animal.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Animal.Builder toBuilder() { + Animal.Builder builder = new Animal.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index e3f4d272de5c..79105f8b9e16 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -93,5 +93,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ArrayOfArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfArrayOfNumberOnly()); + } + + protected Builder(ArrayOfArrayOfNumberOnly instance) { + this.instance = instance; + } + + protected Builder copyOf(ArrayOfArrayOfNumberOnly value) { + this.instance.setArrayArrayNumber(value.arrayArrayNumber); + return this; + } + + public ArrayOfArrayOfNumberOnly.Builder arrayArrayNumber(List> arrayArrayNumber) { + this.instance.arrayArrayNumber(arrayArrayNumber); + return this; + } + + /** + * returns a built ArrayOfArrayOfNumberOnly instance. + * + * The builder is not reusable (NullPointerException) + */ + public ArrayOfArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ArrayOfArrayOfNumberOnly.Builder builder() { + return new ArrayOfArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfArrayOfNumberOnly.Builder toBuilder() { + ArrayOfArrayOfNumberOnly.Builder builder = new ArrayOfArrayOfNumberOnly.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java index 6a71d37dcf1c..1257ac5909f2 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -93,5 +93,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfNumberOnly()); + } + + protected Builder(ArrayOfNumberOnly instance) { + this.instance = instance; + } + + protected Builder copyOf(ArrayOfNumberOnly value) { + this.instance.setArrayNumber(value.arrayNumber); + return this; + } + + public ArrayOfNumberOnly.Builder arrayNumber(List arrayNumber) { + this.instance.arrayNumber(arrayNumber); + return this; + } + + /** + * returns a built ArrayOfNumberOnly instance. + * + * The builder is not reusable (NullPointerException) + */ + public ArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ArrayOfNumberOnly.Builder builder() { + return new ArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfNumberOnly.Builder toBuilder() { + ArrayOfNumberOnly.Builder builder = new ArrayOfNumberOnly.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayTest.java index f5aa226a3d27..fd2675d0e901 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayTest.java @@ -159,5 +159,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ArrayTest instance; + + public Builder() { + this(new ArrayTest()); + } + + protected Builder(ArrayTest instance) { + this.instance = instance; + } + + protected Builder copyOf(ArrayTest value) { + this.instance.setArrayOfString(value.arrayOfString); + this.instance.setArrayArrayOfInteger(value.arrayArrayOfInteger); + this.instance.setArrayArrayOfModel(value.arrayArrayOfModel); + return this; + } + + public ArrayTest.Builder arrayOfString(List arrayOfString) { + this.instance.arrayOfString(arrayOfString); + return this; + } + + public ArrayTest.Builder arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.instance.arrayArrayOfInteger(arrayArrayOfInteger); + return this; + } + + public ArrayTest.Builder arrayArrayOfModel(List> arrayArrayOfModel) { + this.instance.arrayArrayOfModel(arrayArrayOfModel); + return this; + } + + /** + * returns a built ArrayTest instance. + * + * The builder is not reusable (NullPointerException) + */ + public ArrayTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ArrayTest.Builder builder() { + return new ArrayTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayTest.Builder toBuilder() { + ArrayTest.Builder builder = new ArrayTest.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java index 5d15e8f65a64..cbd8b4a14ef5 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java @@ -153,5 +153,84 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Cat.Builder { + + private BigCat instance; + + public Builder() { + this(new BigCat()); + } + + protected Builder(BigCat instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(BigCat value) { + super.copyOf(instance); + this.instance.setKind(value.kind); + return this; + } + + public BigCat.Builder kind(KindEnum kind) { + this.instance.kind(kind); + return this; + } + + @Override + public BigCat.Builder declawed(Boolean declawed) { + this.instance.declawed(declawed); + return this; + } + + @Override + public BigCat.Builder className(String className) { + this.instance.className(className); + return this; + } + + @Override + public BigCat.Builder color(String color) { + this.instance.color(color); + return this; + } + + /** + * returns a built BigCat instance. + * + * The builder is not reusable (NullPointerException) + */ + public BigCat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static BigCat.Builder builder() { + return new BigCat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public BigCat.Builder toBuilder() { + BigCat.Builder builder = new BigCat.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java index 2ff8a2bbf000..48b5e10adae5 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java @@ -200,5 +200,93 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Capitalization instance; + + public Builder() { + this(new Capitalization()); + } + + protected Builder(Capitalization instance) { + this.instance = instance; + } + + protected Builder copyOf(Capitalization value) { + this.instance.setSmallCamel(value.smallCamel); + this.instance.setCapitalCamel(value.capitalCamel); + this.instance.setSmallSnake(value.smallSnake); + this.instance.setCapitalSnake(value.capitalSnake); + this.instance.setScAETHFlowPoints(value.scAETHFlowPoints); + this.instance.setATTNAME(value.ATT_NAME); + return this; + } + + public Capitalization.Builder smallCamel(String smallCamel) { + this.instance.smallCamel(smallCamel); + return this; + } + + public Capitalization.Builder capitalCamel(String capitalCamel) { + this.instance.capitalCamel(capitalCamel); + return this; + } + + public Capitalization.Builder smallSnake(String smallSnake) { + this.instance.smallSnake(smallSnake); + return this; + } + + public Capitalization.Builder capitalSnake(String capitalSnake) { + this.instance.capitalSnake(capitalSnake); + return this; + } + + public Capitalization.Builder scAETHFlowPoints(String scAETHFlowPoints) { + this.instance.scAETHFlowPoints(scAETHFlowPoints); + return this; + } + + public Capitalization.Builder ATT_NAME(String ATT_NAME) { + this.instance.ATT_NAME(ATT_NAME); + return this; + } + + /** + * returns a built Capitalization instance. + * + * The builder is not reusable (NullPointerException) + */ + public Capitalization build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Capitalization.Builder builder() { + return new Capitalization.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Capitalization.Builder toBuilder() { + Capitalization.Builder builder = new Capitalization.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java index 6eafc4dcfa26..0fe922483120 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java @@ -116,5 +116,78 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Animal.Builder { + + private Cat instance; + + public Builder() { + this(new Cat()); + } + + protected Builder(Cat instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Cat value) { + super.copyOf(instance); + this.instance.setDeclawed(value.declawed); + return this; + } + + public Cat.Builder declawed(Boolean declawed) { + this.instance.declawed(declawed); + return this; + } + + @Override + public Cat.Builder className(String className) { + this.instance.className(className); + return this; + } + + @Override + public Cat.Builder color(String color) { + this.instance.color(color); + return this; + } + + /** + * returns a built Cat instance. + * + * The builder is not reusable (NullPointerException) + */ + public Cat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Cat.Builder builder() { + return new Cat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Cat.Builder toBuilder() { + Cat.Builder builder = new Cat.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java index d41d7792134d..ce2a64d65e90 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java @@ -115,5 +115,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Category instance; + + public Builder() { + this(new Category()); + } + + protected Builder(Category instance) { + this.instance = instance; + } + + protected Builder copyOf(Category value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Category.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Category.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Category instance. + * + * The builder is not reusable (NullPointerException) + */ + public Category build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Category.Builder builder() { + return new Category.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Category.Builder toBuilder() { + Category.Builder builder = new Category.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ChildWithNullable.java index d4d72ddaccb4..4b3e323e2db1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ChildWithNullable.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ChildWithNullable.java @@ -111,5 +111,83 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends ParentWithNullable.Builder { + + private ChildWithNullable instance; + + public Builder() { + this(new ChildWithNullable()); + } + + protected Builder(ChildWithNullable instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(ChildWithNullable value) { + super.copyOf(instance); + this.instance.setOtherProperty(value.otherProperty); + return this; + } + + public ChildWithNullable.Builder otherProperty(String otherProperty) { + this.instance.otherProperty(otherProperty); + return this; + } + + @Override + public ChildWithNullable.Builder type(TypeEnum type) { + this.instance.type(type); + return this; + } + + @Override + public ChildWithNullable.Builder nullableProperty(String nullableProperty) { + this.instance.nullableProperty(nullableProperty); + return this; + } + + public ChildWithNullable.Builder nullableProperty(JsonNullable nullableProperty) { + this.instance.setNullableProperty(nullableProperty); + return this; + } + + /** + * returns a built ChildWithNullable instance. + * + * The builder is not reusable (NullPointerException) + */ + public ChildWithNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ChildWithNullable.Builder builder() { + return new ChildWithNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ChildWithNullable.Builder toBuilder() { + ChildWithNullable.Builder builder = new ChildWithNullable.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java index d73043244820..e0b25f6fd7c6 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java @@ -81,5 +81,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ClassModel instance; + + public Builder() { + this(new ClassModel()); + } + + protected Builder(ClassModel instance) { + this.instance = instance; + } + + protected Builder copyOf(ClassModel value) { + this.instance.setPropertyClass(value.propertyClass); + return this; + } + + public ClassModel.Builder propertyClass(String propertyClass) { + this.instance.propertyClass(propertyClass); + return this; + } + + /** + * returns a built ClassModel instance. + * + * The builder is not reusable (NullPointerException) + */ + public ClassModel build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ClassModel.Builder builder() { + return new ClassModel.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ClassModel.Builder toBuilder() { + ClassModel.Builder builder = new ClassModel.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java index c27291237890..935c6f813bcb 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java @@ -80,5 +80,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Client instance; + + public Builder() { + this(new Client()); + } + + protected Builder(Client instance) { + this.instance = instance; + } + + protected Builder copyOf(Client value) { + this.instance.setClient(value.client); + return this; + } + + public Client.Builder client(String client) { + this.instance.client(client); + return this; + } + + /** + * returns a built Client instance. + * + * The builder is not reusable (NullPointerException) + */ + public Client build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Client.Builder builder() { + return new Client.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Client.Builder toBuilder() { + Client.Builder builder = new Client.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java index f635ce8a4b69..3ab4a13e1f71 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -216,5 +216,96 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ContainerDefaultValue instance; + + public Builder() { + this(new ContainerDefaultValue()); + } + + protected Builder(ContainerDefaultValue instance) { + this.instance = instance; + } + + protected Builder copyOf(ContainerDefaultValue value) { + this.instance.setNullableArray(value.nullableArray); + this.instance.setNullableRequiredArray(value.nullableRequiredArray); + this.instance.setRequiredArray(value.requiredArray); + this.instance.setNullableArrayWithDefault(value.nullableArrayWithDefault); + return this; + } + + public ContainerDefaultValue.Builder nullableArray(List nullableArray) { + this.instance.nullableArray(nullableArray); + return this; + } + + public ContainerDefaultValue.Builder nullableArray(JsonNullable> nullableArray) { + this.instance.nullableArray = nullableArray; + return this; + } + + public ContainerDefaultValue.Builder nullableRequiredArray(List nullableRequiredArray) { + this.instance.nullableRequiredArray(nullableRequiredArray); + return this; + } + + public ContainerDefaultValue.Builder nullableRequiredArray(JsonNullable> nullableRequiredArray) { + this.instance.nullableRequiredArray = nullableRequiredArray; + return this; + } + + public ContainerDefaultValue.Builder requiredArray(List requiredArray) { + this.instance.requiredArray(requiredArray); + return this; + } + + public ContainerDefaultValue.Builder nullableArrayWithDefault(List nullableArrayWithDefault) { + this.instance.nullableArrayWithDefault(nullableArrayWithDefault); + return this; + } + + public ContainerDefaultValue.Builder nullableArrayWithDefault(JsonNullable> nullableArrayWithDefault) { + this.instance.nullableArrayWithDefault = nullableArrayWithDefault; + return this; + } + + /** + * returns a built ContainerDefaultValue instance. + * + * The builder is not reusable (NullPointerException) + */ + public ContainerDefaultValue build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ContainerDefaultValue.Builder builder() { + return new ContainerDefaultValue.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ContainerDefaultValue.Builder toBuilder() { + ContainerDefaultValue.Builder builder = new ContainerDefaultValue.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java index 2671d3b023d4..cde4c8461e04 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java @@ -108,5 +108,78 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Animal.Builder { + + private Dog instance; + + public Builder() { + this(new Dog()); + } + + protected Builder(Dog instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Dog value) { + super.copyOf(instance); + this.instance.setBreed(value.breed); + return this; + } + + public Dog.Builder breed(String breed) { + this.instance.breed(breed); + return this; + } + + @Override + public Dog.Builder className(String className) { + this.instance.className(className); + return this; + } + + @Override + public Dog.Builder color(String color) { + this.instance.color(color); + return this; + } + + /** + * returns a built Dog instance. + * + * The builder is not reusable (NullPointerException) + */ + public Dog build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Dog.Builder builder() { + return new Dog.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Dog.Builder toBuilder() { + Dog.Builder builder = new Dog.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java index 9304eab13523..0d61255a8cb1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java @@ -187,5 +187,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private EnumArrays instance; + + public Builder() { + this(new EnumArrays()); + } + + protected Builder(EnumArrays instance) { + this.instance = instance; + } + + protected Builder copyOf(EnumArrays value) { + this.instance.setJustSymbol(value.justSymbol); + this.instance.setArrayEnum(value.arrayEnum); + return this; + } + + public EnumArrays.Builder justSymbol(JustSymbolEnum justSymbol) { + this.instance.justSymbol(justSymbol); + return this; + } + + public EnumArrays.Builder arrayEnum(List arrayEnum) { + this.instance.arrayEnum(arrayEnum); + return this; + } + + /** + * returns a built EnumArrays instance. + * + * The builder is not reusable (NullPointerException) + */ + public EnumArrays build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static EnumArrays.Builder builder() { + return new EnumArrays.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumArrays.Builder toBuilder() { + EnumArrays.Builder builder = new EnumArrays.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java index b8fc67659c78..ce8e80f0235e 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java @@ -335,5 +335,87 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private EnumTest instance; + + public Builder() { + this(new EnumTest()); + } + + protected Builder(EnumTest instance) { + this.instance = instance; + } + + protected Builder copyOf(EnumTest value) { + this.instance.setEnumString(value.enumString); + this.instance.setEnumStringRequired(value.enumStringRequired); + this.instance.setEnumInteger(value.enumInteger); + this.instance.setEnumNumber(value.enumNumber); + this.instance.setOuterEnum(value.outerEnum); + return this; + } + + public EnumTest.Builder enumString(EnumStringEnum enumString) { + this.instance.enumString(enumString); + return this; + } + + public EnumTest.Builder enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.instance.enumStringRequired(enumStringRequired); + return this; + } + + public EnumTest.Builder enumInteger(EnumIntegerEnum enumInteger) { + this.instance.enumInteger(enumInteger); + return this; + } + + public EnumTest.Builder enumNumber(EnumNumberEnum enumNumber) { + this.instance.enumNumber(enumNumber); + return this; + } + + public EnumTest.Builder outerEnum(OuterEnum outerEnum) { + this.instance.outerEnum(outerEnum); + return this; + } + + /** + * returns a built EnumTest instance. + * + * The builder is not reusable (NullPointerException) + */ + public EnumTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static EnumTest.Builder builder() { + return new EnumTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumTest.Builder toBuilder() { + EnumTest.Builder builder = new EnumTest.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/File.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/File.java index 7ac760a29543..f591df1c3d52 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/File.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/File.java @@ -81,5 +81,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private File instance; + + public Builder() { + this(new File()); + } + + protected Builder(File instance) { + this.instance = instance; + } + + protected Builder copyOf(File value) { + this.instance.setSourceURI(value.sourceURI); + return this; + } + + public File.Builder sourceURI(String sourceURI) { + this.instance.sourceURI(sourceURI); + return this; + } + + /** + * returns a built File instance. + * + * The builder is not reusable (NullPointerException) + */ + public File build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static File.Builder builder() { + return new File.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public File.Builder toBuilder() { + File.Builder builder = new File.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FileSchemaTestClass.java index 8b451c79b77e..64c474a1860d 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FileSchemaTestClass.java @@ -117,5 +117,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private FileSchemaTestClass instance; + + public Builder() { + this(new FileSchemaTestClass()); + } + + protected Builder(FileSchemaTestClass instance) { + this.instance = instance; + } + + protected Builder copyOf(FileSchemaTestClass value) { + this.instance.setFile(value.file); + this.instance.setFiles(value.files); + return this; + } + + public FileSchemaTestClass.Builder file(File file) { + this.instance.file(file); + return this; + } + + public FileSchemaTestClass.Builder files(List<@Valid File> files) { + this.instance.files(files); + return this; + } + + /** + * returns a built FileSchemaTestClass instance. + * + * The builder is not reusable (NullPointerException) + */ + public FileSchemaTestClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FileSchemaTestClass.Builder builder() { + return new FileSchemaTestClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileSchemaTestClass.Builder toBuilder() { + FileSchemaTestClass.Builder builder = new FileSchemaTestClass.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java index 6d1fad2c21df..b37c5f0d4f03 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java @@ -426,5 +426,141 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private FormatTest instance; + + public Builder() { + this(new FormatTest()); + } + + protected Builder(FormatTest instance) { + this.instance = instance; + } + + protected Builder copyOf(FormatTest value) { + this.instance.setInteger(value.integer); + this.instance.setInt32(value.int32); + this.instance.setInt64(value.int64); + this.instance.setNumber(value.number); + this.instance.setFloat(value._float); + this.instance.setDouble(value._double); + this.instance.setString(value.string); + this.instance.setByte(value._byte); + this.instance.setBinary(value.binary); + this.instance.setDate(value.date); + this.instance.setDateTime(value.dateTime); + this.instance.setUuid(value.uuid); + this.instance.setPassword(value.password); + this.instance.setBigDecimal(value.bigDecimal); + return this; + } + + public FormatTest.Builder integer(Integer integer) { + this.instance.integer(integer); + return this; + } + + public FormatTest.Builder int32(Integer int32) { + this.instance.int32(int32); + return this; + } + + public FormatTest.Builder int64(Long int64) { + this.instance.int64(int64); + return this; + } + + public FormatTest.Builder number(BigDecimal number) { + this.instance.number(number); + return this; + } + + public FormatTest.Builder _float(Float _float) { + this.instance._float(_float); + return this; + } + + public FormatTest.Builder _double(Double _double) { + this.instance._double(_double); + return this; + } + + public FormatTest.Builder string(String string) { + this.instance.string(string); + return this; + } + + public FormatTest.Builder _byte(byte[] _byte) { + this.instance._byte(_byte); + return this; + } + + public FormatTest.Builder binary(org.springframework.core.io.Resource binary) { + this.instance.binary(binary); + return this; + } + + public FormatTest.Builder date(LocalDate date) { + this.instance.date(date); + return this; + } + + public FormatTest.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime(dateTime); + return this; + } + + public FormatTest.Builder uuid(UUID uuid) { + this.instance.uuid(uuid); + return this; + } + + public FormatTest.Builder password(String password) { + this.instance.password(password); + return this; + } + + public FormatTest.Builder bigDecimal(BigDecimal bigDecimal) { + this.instance.bigDecimal(bigDecimal); + return this; + } + + /** + * returns a built FormatTest instance. + * + * The builder is not reusable (NullPointerException) + */ + public FormatTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FormatTest.Builder builder() { + return new FormatTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FormatTest.Builder toBuilder() { + FormatTest.Builder builder = new FormatTest.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 4da93bdc44d5..4095eb3bd8d4 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -106,5 +106,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private HasOnlyReadOnly instance; + + public Builder() { + this(new HasOnlyReadOnly()); + } + + protected Builder(HasOnlyReadOnly instance) { + this.instance = instance; + } + + protected Builder copyOf(HasOnlyReadOnly value) { + this.instance.setBar(value.bar); + this.instance.setFoo(value.foo); + return this; + } + + public HasOnlyReadOnly.Builder bar(String bar) { + this.instance.bar(bar); + return this; + } + + public HasOnlyReadOnly.Builder foo(String foo) { + this.instance.foo(foo); + return this; + } + + /** + * returns a built HasOnlyReadOnly instance. + * + * The builder is not reusable (NullPointerException) + */ + public HasOnlyReadOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static HasOnlyReadOnly.Builder builder() { + return new HasOnlyReadOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public HasOnlyReadOnly.Builder toBuilder() { + HasOnlyReadOnly.Builder builder = new HasOnlyReadOnly.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java index 58d65f476b76..e7cf6b885a08 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java @@ -226,5 +226,81 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private MapTest instance; + + public Builder() { + this(new MapTest()); + } + + protected Builder(MapTest instance) { + this.instance = instance; + } + + protected Builder copyOf(MapTest value) { + this.instance.setMapMapOfString(value.mapMapOfString); + this.instance.setMapOfEnumString(value.mapOfEnumString); + this.instance.setDirectMap(value.directMap); + this.instance.setIndirectMap(value.indirectMap); + return this; + } + + public MapTest.Builder mapMapOfString(Map> mapMapOfString) { + this.instance.mapMapOfString(mapMapOfString); + return this; + } + + public MapTest.Builder mapOfEnumString(Map mapOfEnumString) { + this.instance.mapOfEnumString(mapOfEnumString); + return this; + } + + public MapTest.Builder directMap(Map directMap) { + this.instance.directMap(directMap); + return this; + } + + public MapTest.Builder indirectMap(Map indirectMap) { + this.instance.indirectMap(indirectMap); + return this; + } + + /** + * returns a built MapTest instance. + * + * The builder is not reusable (NullPointerException) + */ + public MapTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static MapTest.Builder builder() { + return new MapTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MapTest.Builder toBuilder() { + MapTest.Builder builder = new MapTest.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index a3845d0107ec..7b002a83a22e 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -144,5 +144,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private MixedPropertiesAndAdditionalPropertiesClass instance; + + public Builder() { + this(new MixedPropertiesAndAdditionalPropertiesClass()); + } + + protected Builder(MixedPropertiesAndAdditionalPropertiesClass instance) { + this.instance = instance; + } + + protected Builder copyOf(MixedPropertiesAndAdditionalPropertiesClass value) { + this.instance.setUuid(value.uuid); + this.instance.setDateTime(value.dateTime); + this.instance.setMap(value.map); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder uuid(UUID uuid) { + this.instance.uuid(uuid); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime(dateTime); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder map(Map map) { + this.instance.map(map); + return this; + } + + /** + * returns a built MixedPropertiesAndAdditionalPropertiesClass instance. + * + * The builder is not reusable (NullPointerException) + */ + public MixedPropertiesAndAdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static MixedPropertiesAndAdditionalPropertiesClass.Builder builder() { + return new MixedPropertiesAndAdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MixedPropertiesAndAdditionalPropertiesClass.Builder toBuilder() { + MixedPropertiesAndAdditionalPropertiesClass.Builder builder = new MixedPropertiesAndAdditionalPropertiesClass.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java index 8ab057fc33c5..ef4a6e9400f1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java @@ -107,5 +107,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Model200Response instance; + + public Builder() { + this(new Model200Response()); + } + + protected Builder(Model200Response instance) { + this.instance = instance; + } + + protected Builder copyOf(Model200Response value) { + this.instance.setName(value.name); + this.instance.setPropertyClass(value.propertyClass); + return this; + } + + public Model200Response.Builder name(Integer name) { + this.instance.name(name); + return this; + } + + public Model200Response.Builder propertyClass(String propertyClass) { + this.instance.propertyClass(propertyClass); + return this; + } + + /** + * returns a built Model200Response instance. + * + * The builder is not reusable (NullPointerException) + */ + public Model200Response build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Model200Response.Builder builder() { + return new Model200Response.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Model200Response.Builder toBuilder() { + Model200Response.Builder builder = new Model200Response.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java index 9a9c8445cb89..2c7e686cd431 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -130,5 +130,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ModelApiResponse instance; + + public Builder() { + this(new ModelApiResponse()); + } + + protected Builder(ModelApiResponse instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelApiResponse value) { + this.instance.setCode(value.code); + this.instance.setType(value.type); + this.instance.setMessage(value.message); + return this; + } + + public ModelApiResponse.Builder code(Integer code) { + this.instance.code(code); + return this; + } + + public ModelApiResponse.Builder type(String type) { + this.instance.type(type); + return this; + } + + public ModelApiResponse.Builder message(String message) { + this.instance.message(message); + return this; + } + + /** + * returns a built ModelApiResponse instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelApiResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelApiResponse.Builder builder() { + return new ModelApiResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelApiResponse.Builder toBuilder() { + ModelApiResponse.Builder builder = new ModelApiResponse.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelList.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelList.java index 79768b5d8e3d..c29cfdc3ceb1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelList.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelList.java @@ -82,5 +82,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ModelList instance; + + public Builder() { + this(new ModelList()); + } + + protected Builder(ModelList instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelList value) { + this.instance.set123list(value._123list); + return this; + } + + public ModelList.Builder _123list(String _123list) { + this.instance._123list(_123list); + return this; + } + + /** + * returns a built ModelList instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelList build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelList.Builder builder() { + return new ModelList.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelList.Builder toBuilder() { + ModelList.Builder builder = new ModelList.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java index 6d54c0a05f5b..46298ecf6388 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java @@ -83,5 +83,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ModelReturn instance; + + public Builder() { + this(new ModelReturn()); + } + + protected Builder(ModelReturn instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelReturn value) { + this.instance.setReturn(value._return); + return this; + } + + public ModelReturn.Builder _return(Integer _return) { + this.instance._return(_return); + return this; + } + + /** + * returns a built ModelReturn instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelReturn build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelReturn.Builder builder() { + return new ModelReturn.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelReturn.Builder toBuilder() { + ModelReturn.Builder builder = new ModelReturn.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java index 50a41b54f361..333459a240c6 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java @@ -164,5 +164,81 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Name instance; + + public Builder() { + this(new Name()); + } + + protected Builder(Name instance) { + this.instance = instance; + } + + protected Builder copyOf(Name value) { + this.instance.setName(value.name); + this.instance.setSnakeCase(value.snakeCase); + this.instance.setProperty(value.property); + this.instance.set123number(value._123number); + return this; + } + + public Name.Builder name(Integer name) { + this.instance.name(name); + return this; + } + + public Name.Builder snakeCase(Integer snakeCase) { + this.instance.snakeCase(snakeCase); + return this; + } + + public Name.Builder property(String property) { + this.instance.property(property); + return this; + } + + public Name.Builder _123number(Integer _123number) { + this.instance._123number(_123number); + return this; + } + + /** + * returns a built Name instance. + * + * The builder is not reusable (NullPointerException) + */ + public Name build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Name.Builder builder() { + return new Name.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Name.Builder toBuilder() { + Name.Builder builder = new Name.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java index bc0a415abe0b..f57825e3a7df 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -105,5 +105,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private NullableMapProperty instance; + + public Builder() { + this(new NullableMapProperty()); + } + + protected Builder(NullableMapProperty instance) { + this.instance = instance; + } + + protected Builder copyOf(NullableMapProperty value) { + this.instance.setLanguageValues(value.languageValues); + return this; + } + + public NullableMapProperty.Builder languageValues(Map languageValues) { + this.instance.languageValues(languageValues); + return this; + } + + public NullableMapProperty.Builder languageValues(JsonNullable> languageValues) { + this.instance.languageValues = languageValues; + return this; + } + + /** + * returns a built NullableMapProperty instance. + * + * The builder is not reusable (NullPointerException) + */ + public NullableMapProperty build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static NullableMapProperty.Builder builder() { + return new NullableMapProperty.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NullableMapProperty.Builder toBuilder() { + NullableMapProperty.Builder builder = new NullableMapProperty.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java index 5d5857c8d876..e328dd287745 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java @@ -81,5 +81,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private NumberOnly instance; + + public Builder() { + this(new NumberOnly()); + } + + protected Builder(NumberOnly instance) { + this.instance = instance; + } + + protected Builder copyOf(NumberOnly value) { + this.instance.setJustNumber(value.justNumber); + return this; + } + + public NumberOnly.Builder justNumber(BigDecimal justNumber) { + this.instance.justNumber(justNumber); + return this; + } + + /** + * returns a built NumberOnly instance. + * + * The builder is not reusable (NullPointerException) + */ + public NumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static NumberOnly.Builder builder() { + return new NumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NumberOnly.Builder toBuilder() { + NumberOnly.Builder builder = new NumberOnly.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java index ddd58e60bf9f..87f205528773 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java @@ -241,5 +241,93 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Order instance; + + public Builder() { + this(new Order()); + } + + protected Builder(Order instance) { + this.instance = instance; + } + + protected Builder copyOf(Order value) { + this.instance.setId(value.id); + this.instance.setPetId(value.petId); + this.instance.setQuantity(value.quantity); + this.instance.setShipDate(value.shipDate); + this.instance.setStatus(value.status); + this.instance.setComplete(value.complete); + return this; + } + + public Order.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Order.Builder petId(Long petId) { + this.instance.petId(petId); + return this; + } + + public Order.Builder quantity(Integer quantity) { + this.instance.quantity(quantity); + return this; + } + + public Order.Builder shipDate(OffsetDateTime shipDate) { + this.instance.shipDate(shipDate); + return this; + } + + public Order.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + + public Order.Builder complete(Boolean complete) { + this.instance.complete(complete); + return this; + } + + /** + * returns a built Order instance. + * + * The builder is not reusable (NullPointerException) + */ + public Order build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Order.Builder builder() { + return new Order.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Order.Builder toBuilder() { + Order.Builder builder = new Order.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java index 42fdbbca421e..341a192d0991 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java @@ -129,5 +129,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private OuterComposite instance; + + public Builder() { + this(new OuterComposite()); + } + + protected Builder(OuterComposite instance) { + this.instance = instance; + } + + protected Builder copyOf(OuterComposite value) { + this.instance.setMyNumber(value.myNumber); + this.instance.setMyString(value.myString); + this.instance.setMyBoolean(value.myBoolean); + return this; + } + + public OuterComposite.Builder myNumber(BigDecimal myNumber) { + this.instance.myNumber(myNumber); + return this; + } + + public OuterComposite.Builder myString(String myString) { + this.instance.myString(myString); + return this; + } + + public OuterComposite.Builder myBoolean(Boolean myBoolean) { + this.instance.myBoolean(myBoolean); + return this; + } + + /** + * returns a built OuterComposite instance. + * + * The builder is not reusable (NullPointerException) + */ + public OuterComposite build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static OuterComposite.Builder builder() { + return new OuterComposite.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OuterComposite.Builder toBuilder() { + OuterComposite.Builder builder = new OuterComposite.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java index 4ebf6b46e8af..ae5f5afac13a 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -164,5 +164,74 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ParentWithNullable instance; + + public Builder() { + this(new ParentWithNullable()); + } + + protected Builder(ParentWithNullable instance) { + this.instance = instance; + } + + protected Builder copyOf(ParentWithNullable value) { + this.instance.setType(value.type); + this.instance.setNullableProperty(value.nullableProperty); + return this; + } + + public ParentWithNullable.Builder type(TypeEnum type) { + this.instance.type(type); + return this; + } + + public ParentWithNullable.Builder nullableProperty(String nullableProperty) { + this.instance.nullableProperty(nullableProperty); + return this; + } + + public ParentWithNullable.Builder nullableProperty(JsonNullable nullableProperty) { + this.instance.nullableProperty = nullableProperty; + return this; + } + + /** + * returns a built ParentWithNullable instance. + * + * The builder is not reusable (NullPointerException) + */ + public ParentWithNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ParentWithNullable.Builder builder() { + return new ParentWithNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ParentWithNullable.Builder toBuilder() { + ParentWithNullable.Builder builder = new ParentWithNullable.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java index 4e6fec4f209d..f077901b3c06 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java @@ -284,5 +284,95 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Pet instance; + + public Builder() { + this(new Pet()); + } + + protected Builder(Pet instance) { + this.instance = instance; + } + + protected Builder copyOf(Pet value) { + this.instance.setId(value.id); + this.instance.setCategory(value.category); + this.instance.setName(value.name); + this.instance.setPhotoUrls(value.photoUrls); + this.instance.setTags(value.tags); + this.instance.setStatus(value.status); + return this; + } + + public Pet.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Pet.Builder category(Category category) { + this.instance.category(category); + return this; + } + + public Pet.Builder name(String name) { + this.instance.name(name); + return this; + } + + public Pet.Builder photoUrls(Set photoUrls) { + this.instance.photoUrls(photoUrls); + return this; + } + + public Pet.Builder tags(List<@Valid Tag> tags) { + this.instance.tags(tags); + return this; + } + + @Deprecated + public Pet.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + @Deprecated + + /** + * returns a built Pet instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pet.Builder builder() { + return new Pet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pet.Builder toBuilder() { + Pet.Builder builder = new Pet.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java index c4dee488a930..c681f43e9f7b 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -104,5 +104,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ReadOnlyFirst instance; + + public Builder() { + this(new ReadOnlyFirst()); + } + + protected Builder(ReadOnlyFirst instance) { + this.instance = instance; + } + + protected Builder copyOf(ReadOnlyFirst value) { + this.instance.setBar(value.bar); + this.instance.setBaz(value.baz); + return this; + } + + public ReadOnlyFirst.Builder bar(String bar) { + this.instance.bar(bar); + return this; + } + + public ReadOnlyFirst.Builder baz(String baz) { + this.instance.baz(baz); + return this; + } + + /** + * returns a built ReadOnlyFirst instance. + * + * The builder is not reusable (NullPointerException) + */ + public ReadOnlyFirst build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ReadOnlyFirst.Builder builder() { + return new ReadOnlyFirst.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ReadOnlyFirst.Builder toBuilder() { + ReadOnlyFirst.Builder builder = new ReadOnlyFirst.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java index dafef938f076..ae21f7e50e73 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java @@ -152,5 +152,81 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ResponseObjectWithDifferentFieldNames instance; + + public Builder() { + this(new ResponseObjectWithDifferentFieldNames()); + } + + protected Builder(ResponseObjectWithDifferentFieldNames instance) { + this.instance = instance; + } + + protected Builder copyOf(ResponseObjectWithDifferentFieldNames value) { + this.instance.setNormalPropertyName(value.normalPropertyName); + this.instance.setUPPERCASEPROPERTYSNAKE(value.UPPER_CASE_PROPERTY_SNAKE); + this.instance.setLowerCasePropertyDashes(value.lowerCasePropertyDashes); + this.instance.setPropertyNameWithSpaces(value.propertyNameWithSpaces); + return this; + } + + public ResponseObjectWithDifferentFieldNames.Builder normalPropertyName(String normalPropertyName) { + this.instance.normalPropertyName(normalPropertyName); + return this; + } + + public ResponseObjectWithDifferentFieldNames.Builder UPPER_CASE_PROPERTY_SNAKE(String UPPER_CASE_PROPERTY_SNAKE) { + this.instance.UPPER_CASE_PROPERTY_SNAKE(UPPER_CASE_PROPERTY_SNAKE); + return this; + } + + public ResponseObjectWithDifferentFieldNames.Builder lowerCasePropertyDashes(String lowerCasePropertyDashes) { + this.instance.lowerCasePropertyDashes(lowerCasePropertyDashes); + return this; + } + + public ResponseObjectWithDifferentFieldNames.Builder propertyNameWithSpaces(String propertyNameWithSpaces) { + this.instance.propertyNameWithSpaces(propertyNameWithSpaces); + return this; + } + + /** + * returns a built ResponseObjectWithDifferentFieldNames instance. + * + * The builder is not reusable (NullPointerException) + */ + public ResponseObjectWithDifferentFieldNames build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ResponseObjectWithDifferentFieldNames.Builder builder() { + return new ResponseObjectWithDifferentFieldNames.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ResponseObjectWithDifferentFieldNames.Builder toBuilder() { + ResponseObjectWithDifferentFieldNames.Builder builder = new ResponseObjectWithDifferentFieldNames.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java index e4c8856cf7c5..bdbcd884347f 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java @@ -82,5 +82,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private SpecialModelName instance; + + public Builder() { + this(new SpecialModelName()); + } + + protected Builder(SpecialModelName instance) { + this.instance = instance; + } + + protected Builder copyOf(SpecialModelName value) { + this.instance.set$SpecialPropertyName(value.$specialPropertyName); + return this; + } + + public SpecialModelName.Builder $specialPropertyName(Long $specialPropertyName) { + this.instance.$specialPropertyName($specialPropertyName); + return this; + } + + /** + * returns a built SpecialModelName instance. + * + * The builder is not reusable (NullPointerException) + */ + public SpecialModelName build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static SpecialModelName.Builder builder() { + return new SpecialModelName.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public SpecialModelName.Builder toBuilder() { + SpecialModelName.Builder builder = new SpecialModelName.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java index 1aa58e54b307..29d218fcfc25 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java @@ -104,5 +104,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Tag instance; + + public Builder() { + this(new Tag()); + } + + protected Builder(Tag instance) { + this.instance = instance; + } + + protected Builder copyOf(Tag value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Tag.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Tag.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Tag instance. + * + * The builder is not reusable (NullPointerException) + */ + public Tag build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Tag.Builder builder() { + return new Tag.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Tag.Builder toBuilder() { + Tag.Builder builder = new Tag.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderDefault.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderDefault.java index ee2790ac7c95..9062db776b85 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderDefault.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderDefault.java @@ -204,5 +204,87 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private TypeHolderDefault instance; + + public Builder() { + this(new TypeHolderDefault()); + } + + protected Builder(TypeHolderDefault instance) { + this.instance = instance; + } + + protected Builder copyOf(TypeHolderDefault value) { + this.instance.setStringItem(value.stringItem); + this.instance.setNumberItem(value.numberItem); + this.instance.setIntegerItem(value.integerItem); + this.instance.setBoolItem(value.boolItem); + this.instance.setArrayItem(value.arrayItem); + return this; + } + + public TypeHolderDefault.Builder stringItem(String stringItem) { + this.instance.stringItem(stringItem); + return this; + } + + public TypeHolderDefault.Builder numberItem(BigDecimal numberItem) { + this.instance.numberItem(numberItem); + return this; + } + + public TypeHolderDefault.Builder integerItem(Integer integerItem) { + this.instance.integerItem(integerItem); + return this; + } + + public TypeHolderDefault.Builder boolItem(Boolean boolItem) { + this.instance.boolItem(boolItem); + return this; + } + + public TypeHolderDefault.Builder arrayItem(List arrayItem) { + this.instance.arrayItem(arrayItem); + return this; + } + + /** + * returns a built TypeHolderDefault instance. + * + * The builder is not reusable (NullPointerException) + */ + public TypeHolderDefault build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static TypeHolderDefault.Builder builder() { + return new TypeHolderDefault.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public TypeHolderDefault.Builder toBuilder() { + TypeHolderDefault.Builder builder = new TypeHolderDefault.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderExample.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderExample.java index 728785d71ad1..edcd5d56253a 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderExample.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderExample.java @@ -229,5 +229,93 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private TypeHolderExample instance; + + public Builder() { + this(new TypeHolderExample()); + } + + protected Builder(TypeHolderExample instance) { + this.instance = instance; + } + + protected Builder copyOf(TypeHolderExample value) { + this.instance.setStringItem(value.stringItem); + this.instance.setNumberItem(value.numberItem); + this.instance.setFloatItem(value.floatItem); + this.instance.setIntegerItem(value.integerItem); + this.instance.setBoolItem(value.boolItem); + this.instance.setArrayItem(value.arrayItem); + return this; + } + + public TypeHolderExample.Builder stringItem(String stringItem) { + this.instance.stringItem(stringItem); + return this; + } + + public TypeHolderExample.Builder numberItem(BigDecimal numberItem) { + this.instance.numberItem(numberItem); + return this; + } + + public TypeHolderExample.Builder floatItem(Float floatItem) { + this.instance.floatItem(floatItem); + return this; + } + + public TypeHolderExample.Builder integerItem(Integer integerItem) { + this.instance.integerItem(integerItem); + return this; + } + + public TypeHolderExample.Builder boolItem(Boolean boolItem) { + this.instance.boolItem(boolItem); + return this; + } + + public TypeHolderExample.Builder arrayItem(List arrayItem) { + this.instance.arrayItem(arrayItem); + return this; + } + + /** + * returns a built TypeHolderExample instance. + * + * The builder is not reusable (NullPointerException) + */ + public TypeHolderExample build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static TypeHolderExample.Builder builder() { + return new TypeHolderExample.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public TypeHolderExample.Builder toBuilder() { + TypeHolderExample.Builder builder = new TypeHolderExample.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java index 81ae1f82e67b..4fc36367c73c 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java @@ -248,5 +248,105 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private User instance; + + public Builder() { + this(new User()); + } + + protected Builder(User instance) { + this.instance = instance; + } + + protected Builder copyOf(User value) { + this.instance.setId(value.id); + this.instance.setUsername(value.username); + this.instance.setFirstName(value.firstName); + this.instance.setLastName(value.lastName); + this.instance.setEmail(value.email); + this.instance.setPassword(value.password); + this.instance.setPhone(value.phone); + this.instance.setUserStatus(value.userStatus); + return this; + } + + public User.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public User.Builder username(String username) { + this.instance.username(username); + return this; + } + + public User.Builder firstName(String firstName) { + this.instance.firstName(firstName); + return this; + } + + public User.Builder lastName(String lastName) { + this.instance.lastName(lastName); + return this; + } + + public User.Builder email(String email) { + this.instance.email(email); + return this; + } + + public User.Builder password(String password) { + this.instance.password(password); + return this; + } + + public User.Builder phone(String phone) { + this.instance.phone(phone); + return this; + } + + public User.Builder userStatus(Integer userStatus) { + this.instance.userStatus(userStatus); + return this; + } + + /** + * returns a built User instance. + * + * The builder is not reusable (NullPointerException) + */ + public User build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static User.Builder builder() { + return new User.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public User.Builder toBuilder() { + User.Builder builder = new User.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/XmlItem.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/XmlItem.java index 0ccdee97a000..027719ae764e 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/XmlItem.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/XmlItem.java @@ -837,5 +837,231 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private XmlItem instance; + + public Builder() { + this(new XmlItem()); + } + + protected Builder(XmlItem instance) { + this.instance = instance; + } + + protected Builder copyOf(XmlItem value) { + this.instance.setAttributeString(value.attributeString); + this.instance.setAttributeNumber(value.attributeNumber); + this.instance.setAttributeInteger(value.attributeInteger); + this.instance.setAttributeBoolean(value.attributeBoolean); + this.instance.setWrappedArray(value.wrappedArray); + this.instance.setNameString(value.nameString); + this.instance.setNameNumber(value.nameNumber); + this.instance.setNameInteger(value.nameInteger); + this.instance.setNameBoolean(value.nameBoolean); + this.instance.setNameArray(value.nameArray); + this.instance.setNameWrappedArray(value.nameWrappedArray); + this.instance.setPrefixString(value.prefixString); + this.instance.setPrefixNumber(value.prefixNumber); + this.instance.setPrefixInteger(value.prefixInteger); + this.instance.setPrefixBoolean(value.prefixBoolean); + this.instance.setPrefixArray(value.prefixArray); + this.instance.setPrefixWrappedArray(value.prefixWrappedArray); + this.instance.setNamespaceString(value.namespaceString); + this.instance.setNamespaceNumber(value.namespaceNumber); + this.instance.setNamespaceInteger(value.namespaceInteger); + this.instance.setNamespaceBoolean(value.namespaceBoolean); + this.instance.setNamespaceArray(value.namespaceArray); + this.instance.setNamespaceWrappedArray(value.namespaceWrappedArray); + this.instance.setPrefixNsString(value.prefixNsString); + this.instance.setPrefixNsNumber(value.prefixNsNumber); + this.instance.setPrefixNsInteger(value.prefixNsInteger); + this.instance.setPrefixNsBoolean(value.prefixNsBoolean); + this.instance.setPrefixNsArray(value.prefixNsArray); + this.instance.setPrefixNsWrappedArray(value.prefixNsWrappedArray); + return this; + } + + public XmlItem.Builder attributeString(String attributeString) { + this.instance.attributeString(attributeString); + return this; + } + + public XmlItem.Builder attributeNumber(BigDecimal attributeNumber) { + this.instance.attributeNumber(attributeNumber); + return this; + } + + public XmlItem.Builder attributeInteger(Integer attributeInteger) { + this.instance.attributeInteger(attributeInteger); + return this; + } + + public XmlItem.Builder attributeBoolean(Boolean attributeBoolean) { + this.instance.attributeBoolean(attributeBoolean); + return this; + } + + public XmlItem.Builder wrappedArray(List wrappedArray) { + this.instance.wrappedArray(wrappedArray); + return this; + } + + public XmlItem.Builder nameString(String nameString) { + this.instance.nameString(nameString); + return this; + } + + public XmlItem.Builder nameNumber(BigDecimal nameNumber) { + this.instance.nameNumber(nameNumber); + return this; + } + + public XmlItem.Builder nameInteger(Integer nameInteger) { + this.instance.nameInteger(nameInteger); + return this; + } + + public XmlItem.Builder nameBoolean(Boolean nameBoolean) { + this.instance.nameBoolean(nameBoolean); + return this; + } + + public XmlItem.Builder nameArray(List nameArray) { + this.instance.nameArray(nameArray); + return this; + } + + public XmlItem.Builder nameWrappedArray(List nameWrappedArray) { + this.instance.nameWrappedArray(nameWrappedArray); + return this; + } + + public XmlItem.Builder prefixString(String prefixString) { + this.instance.prefixString(prefixString); + return this; + } + + public XmlItem.Builder prefixNumber(BigDecimal prefixNumber) { + this.instance.prefixNumber(prefixNumber); + return this; + } + + public XmlItem.Builder prefixInteger(Integer prefixInteger) { + this.instance.prefixInteger(prefixInteger); + return this; + } + + public XmlItem.Builder prefixBoolean(Boolean prefixBoolean) { + this.instance.prefixBoolean(prefixBoolean); + return this; + } + + public XmlItem.Builder prefixArray(List prefixArray) { + this.instance.prefixArray(prefixArray); + return this; + } + + public XmlItem.Builder prefixWrappedArray(List prefixWrappedArray) { + this.instance.prefixWrappedArray(prefixWrappedArray); + return this; + } + + public XmlItem.Builder namespaceString(String namespaceString) { + this.instance.namespaceString(namespaceString); + return this; + } + + public XmlItem.Builder namespaceNumber(BigDecimal namespaceNumber) { + this.instance.namespaceNumber(namespaceNumber); + return this; + } + + public XmlItem.Builder namespaceInteger(Integer namespaceInteger) { + this.instance.namespaceInteger(namespaceInteger); + return this; + } + + public XmlItem.Builder namespaceBoolean(Boolean namespaceBoolean) { + this.instance.namespaceBoolean(namespaceBoolean); + return this; + } + + public XmlItem.Builder namespaceArray(List namespaceArray) { + this.instance.namespaceArray(namespaceArray); + return this; + } + + public XmlItem.Builder namespaceWrappedArray(List namespaceWrappedArray) { + this.instance.namespaceWrappedArray(namespaceWrappedArray); + return this; + } + + public XmlItem.Builder prefixNsString(String prefixNsString) { + this.instance.prefixNsString(prefixNsString); + return this; + } + + public XmlItem.Builder prefixNsNumber(BigDecimal prefixNsNumber) { + this.instance.prefixNsNumber(prefixNsNumber); + return this; + } + + public XmlItem.Builder prefixNsInteger(Integer prefixNsInteger) { + this.instance.prefixNsInteger(prefixNsInteger); + return this; + } + + public XmlItem.Builder prefixNsBoolean(Boolean prefixNsBoolean) { + this.instance.prefixNsBoolean(prefixNsBoolean); + return this; + } + + public XmlItem.Builder prefixNsArray(List prefixNsArray) { + this.instance.prefixNsArray(prefixNsArray); + return this; + } + + public XmlItem.Builder prefixNsWrappedArray(List prefixNsWrappedArray) { + this.instance.prefixNsWrappedArray(prefixNsWrappedArray); + return this; + } + + /** + * returns a built XmlItem instance. + * + * The builder is not reusable (NullPointerException) + */ + public XmlItem build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static XmlItem.Builder builder() { + return new XmlItem.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public XmlItem.Builder toBuilder() { + XmlItem.Builder builder = new XmlItem.Builder(); + return builder.copyOf(this); + } + }